MtnMCG

chest slave

Jul 23rd, 2024 (edited)
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. -- Function to deposit all items in the turtle's inventory
  2. local function depositItems()
  3. for slot = 1, 16 do
  4. turtle.select(slot)
  5. turtle.drop()
  6. end
  7. end
  8.  
  9. -- Main program
  10. while true do
  11. print("Press Enter to start the cycle...")
  12. read() -- Wait for user input
  13.  
  14. -- Move forward 16 blocks
  15. for i = 1, 16 do
  16. turtle.forward()
  17. end
  18.  
  19. -- Turn left and move forward 3 blocks
  20. turtle.turnLeft()
  21. for i = 1, 3 do
  22. turtle.forward()
  23. end
  24.  
  25. -- Open chest and deposit items
  26. turtle.select(1)
  27. turtle.drop()
  28. depositItems()
  29.  
  30. -- Return to starting position
  31. turtle.turnLeft()
  32. turtle.turnLeft()
  33. for i = 1, 3 do
  34. turtle.forward()
  35. end
  36. turtle.turnRight()
  37. for i = 1, 16 do
  38. turtle.forward()
  39. end
  40. turtle.turnLeft()
  41. turtle.turnLeft()
  42.  
  43. print("Cycle completed. Turtle is back at the starting position.")
  44. end
  45.  
Advertisement
Add Comment
Please, Sign In to add comment