MtnMCG

GLOBAL TURTLE CONTROL

Jul 22nd, 2024 (edited)
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. -- Universal Turtle Stop Command Broadcaster
  2.  
  3. local wireless = peripheral.find("modem")
  4. if not wireless then
  5. error("No modem found!")
  6. end
  7.  
  8. print("Broadcasting stop command to all possible turtle IDs")
  9.  
  10. -- The stop command structure used in the original controller
  11. local stopCommand = {
  12. command = "stop",
  13. id = "all" -- Using "all" to indicate it's for all turtles
  14. }
  15.  
  16. -- Broadcast the stop command to all possible computer IDs
  17. for id = 0, 65535 do
  18. wireless.transmit(id, os.getComputerID(), stopCommand)
  19. end
  20.  
  21. print("Stop command broadcasted to all possible turtle IDs")
Advertisement
Add Comment
Please, Sign In to add comment