nagoL2015

Goto

Aug 26th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. print("what direction am I facing?")
  2. print("n = north, s = south, e = east, w = west")
  3. direction = read()
  4. if direction == "n" then
  5. print("Im ready to get coorinates.")
  6. end
  7. if direction == "s" then
  8. turtle.turnLeft()
  9. turtle.turnLeft()
  10. print("Im ready to get coordinates.")
  11. end
  12. if direction == "e" then
  13. turtle.turnRight()
  14. print("Im ready to get coordinates .")
  15. end
  16. if direction == "w" then
  17. turtle.turnLeft()
  18. print("Im ready to get coordinates.")
  19. end
  20. print("Current X")
  21. local CX = tonumber(read())
  22.  
  23. print("Current Y")
  24. local CY = tonumber(read())
  25. print(" Current Z")
  26. local CZ = tonumber(read())
  27. print("Destination X")
  28. local DX = tonumber(read())
  29. print("Destination Y")
  30. local  DY = tonumber(read())
  31. print("Destination Z")
  32. local DZ = tonumber(read())
  33. while true do
  34. if CY<DY then
  35.     turtle.digUp()
  36.     turtle.up()
  37.     CY=CY+1
  38. end
  39. if CY>DY then
  40.     turtle.digDown()
  41.     turtle.down()
  42.     CY=CY-1
  43. end
  44. if CX<DX then
  45.     turtle.turnLeft()
  46.     turtle.dig()
  47.     turtle.forward()
  48.     turtle.turnRight()
  49.     CX=CX+1
  50. end
  51. if CX>DX then
  52.     turtle.turnRight()
  53.     turtle.dig()
  54.     turtle.forward()
  55.     turtle.turnLeft()
  56. CX = CX-1
  57. end
  58. if CZ>DZ then
  59.     turtle.dig()
  60.     turtle.forward()
  61.     CZ=CZ-1
  62. end
  63. if CZ<DZ then
  64.     turtle.turnLeft()
  65.     turtle.turnLeft()
  66.     turtle.dig()
  67.     turtle.forward()
  68.     turtle.turnRight()
  69.     turtle.turnRight()
  70.     CZ=CZ+1
  71. end
  72. sleep(0.4)
  73. end
Add Comment
Please, Sign In to add comment