Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. local component = require("component")
  2. local nav = component.navigation
  3. local r = require("robot")
  4. local move=require("component").robot.move
  5. local x, y, z=nav.getPosition()
  6. local newX=io.read()
  7. local newZ=io.read()
  8. print(nav.getPosition())
  9. print(nav.getFacing())
  10. print(x..y..z)
  11. while tonumber(newX)~=x do
  12. x,y,z=nav.getPosition()
  13. print(x..y..z)
  14. if tonumber(newX) > x then
  15. r.move(5)
  16. else
  17. r.move(4)
  18. end
  19. end
  20. while tonumber(newZ) ~= z do
  21. x,y,z=nav.getPosition()
  22. print(x..y..z)
  23. if tonumber(newZ) > z then
  24. r.forward()
  25. else
  26. r.back()
  27. end
  28. end
  29.  
  30.  
  31. print(nav.getPosition())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement