Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Initialize variables
- local movedUp = 0
- -- Dig forward and move forward
- turtle.dig()
- turtle.forward()
- -- Loop until there is no block above the turtle
- while turtle.detectUp() do
- -- Dig up
- turtle.digUp()
- -- Dig and move up
- turtle.dig()
- turtle.up()
- -- Increment the number of times we moved up
- movedUp = movedUp + 1
- end
- -- Turn right and dig
- turtle.turnRight()
- turtle.dig()
- -- Move forward and turn left
- turtle.forward()
- turtle.turnLeft()
- -- Go down the same number of times we moved up without digging
- for i = 1, movedUp do
- -- Dig down and forward and move down
- turtle.digDown()
- turtle.dig()
- turtle.down()
- end
- -- Dig forward once
- turtle.dig()
- -- Turn left and move forward
- turtle.turnLeft()
- turtle.forward()
- -- Turn right and move back to the starting position
- turtle.turnRight()
- turtle.back()
Advertisement
Add Comment
Please, Sign In to add comment