Guest User

Untitled

a guest
Oct 15th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. local slot = 1
  2. local message = ""
  3.  
  4. function checkSlot()
  5. if turtle.getItemCount(slot) ~= 0 then
  6. return true
  7. else
  8. for i = slot, 12 do
  9. if turtle.getItemCount(i) > 0 then
  10. turtle.select(i)
  11. slot = i
  12. return true
  13. end
  14. end
  15. return false
  16. end
  17. end
  18.  
  19. function HasItems()
  20. for i = 1, 12 do
  21. if turtle.getItemCount(i) > 0 then
  22. return true
  23. end
  24. end
  25. return false
  26. end
  27.  
  28. local run = true
  29.  
  30. turtle.select(slot)
  31.  
  32. while run do
  33. while turtle.forward() do
  34. --turtle will move forward to a chest
  35. end
  36. --check to see if chest is empty
  37. if turtle.suck() then
  38. while turtle.suck() do
  39. --fill turtle inventory
  40. end
  41. else
  42. --chest is empty
  43. run = false
  44. message = "chest A ran out of items"
  45. end
  46.  
  47. turtle.turnRight()
  48. turtle.turnRight()
  49.  
  50. while turtle.forward() do
  51. --move to next chest
  52. end
  53.  
  54. --cycle through turtles inventory
  55. while checkSlot() do
  56. --if turtle cant drop an item, chest is full
  57. if turtle.drop() == false and hasItems() then
  58. message = "chest B ran out of space"
  59. run = false
  60. end
  61. end
  62.  
  63. --turn around
  64. turtle.turnRight()
  65. turtle.turnRight()
  66. end
Add Comment
Please, Sign In to add comment