galygious

move

Jul 1st, 2023 (edited)
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. local galymove = require("galymoveAPI")
  2.  
  3. -- Parse command-line arguments
  4. local args = { ... }
  5. if #args < 1 then
  6. print("Usage: move <direction> [steps]")
  7. return
  8. end
  9.  
  10. local direction = args[1]
  11. local steps = tonumber(args[2]) or 1
  12.  
  13. -- Load the position from file
  14. galymove.loadPositionFromFile()
  15.  
  16. -- Move the turtle
  17. galymove.move(direction, steps)
  18.  
  19. -- Save the position to file
  20. galymove.savePositionToFile()
  21.  
  22. -- Retrieve and print the current position
  23. local currentPosition = galymove.getPosition()
  24. print("Current Position: x = " .. currentPosition.x .. ", y = " .. currentPosition.y .. ", z = " .. currentPosition.z)
  25.  
Advertisement
Add Comment
Please, Sign In to add comment