Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("what direction am I facing?")
- print("n = north, s = south, e = east, w = west")
- direction = read()
- if direction == "n" then
- print("Im ready to get coorinates.")
- end
- if direction == "s" then
- turtle.turnLeft()
- turtle.turnLeft()
- print("Im ready to get coordinates.")
- end
- if direction == "e" then
- turtle.turnRight()
- print("Im ready to get coordinates .")
- end
- if direction == "w" then
- turtle.turnLeft()
- print("Im ready to get coordinates.")
- end
- print("Current X")
- local CX = tonumber(read())
- print("Current Y")
- local CY = tonumber(read())
- print(" Current Z")
- local CZ = tonumber(read())
- print("Destination X")
- local DX = tonumber(read())
- print("Destination Y")
- local DY = tonumber(read())
- print("Destination Z")
- local DZ = tonumber(read())
- while true do
- if CY<DY then
- turtle.digUp()
- turtle.up()
- CY=CY+1
- end
- if CY>DY then
- turtle.digDown()
- turtle.down()
- CY=CY-1
- end
- if CX<DX then
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- CX=CX+1
- end
- if CX>DX then
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- CX = CX-1
- end
- if CZ>DZ then
- turtle.dig()
- turtle.forward()
- CZ=CZ-1
- end
- if CZ<DZ then
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- CZ=CZ+1
- end
- sleep(0.4)
- end
Add Comment
Please, Sign In to add comment