Advertisement
karelvysinka

Turtle RECYCLER automat 1

Aug 23rd, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.66 KB | None | 0 0
  1. local version =
  2. 10.0
  3. -- Pri zmene programu je treba na radku 2 zmenit verzi, aby se program automaticky aktualizoval
  4. -- local code je treba zmenit dle potreby
  5.  
  6.  
  7. local code = "2VGZsGbx"
  8.  
  9. --check version
  10. term.clear()
  11. term.setCursorPos(1,1)
  12. print("Program loading...")
  13. print("Current version: "..version)
  14. local updateSite= http.get("http://pastebin.com/raw.php?i="..code)
  15. updateSite.readLine()
  16. local newVersion = updateSite.readLine()
  17. if tonumber(newVersion) > version then
  18.         print("Update required. Updating now...")
  19.         local updateSite = http.get("http://pastebin.com/raw.php?i="..code)
  20.         local siteFile = updateSite.readAll()
  21.         local writeFile = fs.open(shell.getRunningProgram(),"w")
  22.         writeFile.write(siteFile)
  23.         writeFile.close()
  24.         print("The program will now restart your computer.")
  25.         sleep(1)
  26.         os.reboot()
  27. end
  28.  
  29. function start()
  30.     -- start hlavního programu
  31. while true do
  32.     turtle.select(1)
  33.     turtle.suckUp()
  34.     local data = turtle.getItemDetail()
  35.     if data then
  36.         print("Item name: ", data.name)
  37.         print("Item damage value: ", data.damage)
  38.         print("Item count: ", data.count)
  39.             if data.name == "minecraft:cobblestone" then
  40.                 print("Nalezen COBBLESTONE. Posilam ho do RECYCLERu")
  41.                 turtle.drop()
  42.             end
  43.     end
  44. turtle.dropUp()
  45. turtle.select(2)   
  46. turtle.suck()
  47.  
  48. --CABBLE2
  49.     turtle.select(1)
  50.     turtle.suckDown()
  51.     local data = turtle.getItemDetail()
  52.     if data then
  53.         print("Item name: ", data.name)
  54.         print("Item damage value: ", data.damage)
  55.         print("Item count: ", data.count)
  56.             if data.name == "minecraft:dirt" then
  57.                 print("Nalezen DIRT. Posilam ho do RECYCLERu")
  58.                 turtle.drop()
  59.             end
  60.     end
  61. turtle.dropDown()
  62. turtle.select(2)   
  63. turtle.suck()
  64.  
  65. --KONEC CABBLE2
  66.  
  67.  
  68. --DIRT
  69.     turtle.select(1)
  70.     turtle.suckUp()
  71.     local data = turtle.getItemDetail()
  72.     if data then
  73.         print("Item name: ", data.name)
  74.         print("Item damage value: ", data.damage)
  75.         print("Item count: ", data.count)
  76.             if data.name == "minecraft:dirt" then
  77.                 print("Nalezen DIRT. Posilam ho do RECYCLERu")
  78.                 turtle.drop()
  79.             end
  80.     end
  81. turtle.dropUp()
  82. turtle.select(2)   
  83. turtle.suck()
  84.  
  85. --KONEC DIRT
  86.  
  87. --DIRT2
  88.     turtle.select(1)
  89.     turtle.suckDown()
  90.     local data = turtle.getItemDetail()
  91.     if data then
  92.         print("Item name: ", data.name)
  93.         print("Item damage value: ", data.damage)
  94.         print("Item count: ", data.count)
  95.             if data.name == "minecraft:dirt" then
  96.                 print("Nalezen DIRT. Posilam ho do RECYCLERu")
  97.                 turtle.drop()
  98.             end
  99.     end
  100. turtle.dropDown()
  101. turtle.select(2)   
  102. turtle.suck()
  103.  
  104. --KONEC DIRT2
  105.  
  106.  
  107. --konec while
  108. end
  109.    
  110.  
  111.  
  112. -- konec hlavního programu
  113.  
  114. end
  115.  
  116.  
  117. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement