poke5555

Untitled

May 9th, 2022 (edited)
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. -- Initialize variables
  2. local movedUp = 0
  3.  
  4. -- Dig forward and move forward
  5. turtle.dig()
  6. turtle.forward()
  7.  
  8. -- Loop until there is no block above the turtle
  9. while turtle.detectUp() do
  10. -- Dig up
  11. turtle.digUp()
  12.  
  13. -- Dig and move up
  14. turtle.dig()
  15. turtle.up()
  16.  
  17. -- Increment the number of times we moved up
  18. movedUp = movedUp + 1
  19. end
  20.  
  21. -- Turn right and dig
  22. turtle.turnRight()
  23. turtle.dig()
  24.  
  25. -- Move forward and turn left
  26. turtle.forward()
  27. turtle.turnLeft()
  28.  
  29. -- Go down the same number of times we moved up without digging
  30. for i = 1, movedUp do
  31. -- Dig down and forward and move down
  32. turtle.digDown()
  33. turtle.dig()
  34. turtle.down()
  35. end
  36.  
  37. -- Dig forward once
  38. turtle.dig()
  39.  
  40. -- Turn left and move forward
  41. turtle.turnLeft()
  42. turtle.forward()
  43.  
  44. -- Turn right and move back to the starting position
  45. turtle.turnRight()
  46. turtle.back()
Advertisement
Add Comment
Please, Sign In to add comment