Advertisement
1vannn

sortingTurtle

Jun 9th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. local pasteID = "http://pastebin.com/raw.php?i=danWpzhs"
  2. debug = true
  3. pasteContent = http.get(pasteID)
  4. Paste = pasteContent.readAll()
  5. pasteContent.close()
  6. function update()
  7. file = fs.open("startup","r")
  8. contents = file.readAll()
  9. file.close()
  10. if (Paste ~= contents) then
  11. print("Updating program...")
  12. shell.run("delete","startup")
  13. wFile = fs.open("startup","w")
  14. wFile.write(Paste)
  15. wFile.close()
  16. sleep(1)
  17. os.reboot()
  18. end
  19. end
  20. function checkItem(slot)
  21. local data = turtle.getItemDetail(slot)
  22. print("checking slot ", slot)
  23. turtle.select(slot)
  24. if (data) then
  25. print(data.name)
  26. if (data.name == "minecraft:cobblestone" or data.name == "minecraft:gravel") then
  27. turtle.select(slot)
  28. turtle.turnRight()
  29. turtle.drop()
  30. turtle.turnLeft()
  31. else
  32. turtle.select(slot)
  33. turtle.drop()
  34. end
  35. end
  36. end
  37. update()
  38. while true do
  39. for i = 1,16 do
  40. checkItem(i)
  41. sleep(1)
  42. term.clear()
  43. term.setCursorPos(1,1)
  44. end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement