Advertisement
karelvysinka

Turtle sorting CABBLESTONE 1.0

Aug 27th, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.07 KB | None | 0 0
  1. local version =
  2. 1.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. --Vize - plán:
  7. --Nasavani cabblestone z truhly
  8. --tvobra compresed cabblestone
  9. --------------------------------------------------------------------------------------------
  10. --PROGRAM PRO UPDATE
  11. --------------------------------------------------------------------------------------------
  12. local code = "kFdiK7PX"
  13.  
  14. --check version
  15. term.clear()
  16. term.setCursorPos(1,1)
  17. print("Program loading...")
  18. print("Current version: "..version)
  19. local updateSite= http.get("http://pastebin.com/raw.php?i="..code)
  20. updateSite.readLine()
  21. local newVersion = updateSite.readLine()
  22. if tonumber(newVersion) > version then
  23.         print("Update required. Updating now...")
  24.         local updateSite = http.get("http://pastebin.com/raw.php?i="..code)
  25.         local siteFile = updateSite.readAll()
  26.         local writeFile = fs.open(shell.getRunningProgram(),"w")
  27.         writeFile.write(siteFile)
  28.         writeFile.close()
  29.         print("The program will now restart your computer.")
  30.         sleep(1)
  31.         os.reboot()
  32. end
  33. --------------------------------------------------------------------------------------------
  34. -- HLAVNÍ PROGRAM
  35. --------------------------------------------------------------------------------------------
  36. function start()
  37.  
  38. print("Turtle sorting CABBLESTONE")
  39.  
  40. while true do
  41. turtle.select(1)
  42. turtle.suck()
  43. local data1 = turtle.getItemDetail()
  44.  
  45. if data1 then
  46.     print("Item name: ", data1.name)
  47.     dataX1 = data1.name
  48.         if dataX1 == "minecraft:cobblestone" then
  49.             print("Nalezen cobblestone. Provedu umisteni to truhly.")
  50.             turtle.dropUp()
  51.         end
  52.     print("Item damage value: ", data1.damage)
  53.     print("Item count: ", data1.count)
  54. end
  55. turtle.dropDown()
  56.  
  57. --end true do
  58. end
  59.  
  60. end
  61. --------------------------------------------------------------------------------------------
  62. -- KONEC HLAVNIHO PROGRAMU
  63. --------------------------------------------------------------------------------------------
  64.  
  65. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement