Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. args = { ... }
  2. -- turtleid unload|finish|pause|restart [top|left|right|back]
  3.  
  4. local turtleId = 0
  5. local cmd = ""
  6. local position = "top"
  7. local ack = nil
  8.  
  9. if args[1] == nil or args[2] == nil then
  10. print("turtleId unload|finish|pause|restart [top|left|right|back]")
  11. return
  12. end
  13.  
  14.  
  15. turtleId = tonumber(args[1])
  16. cmd = args[2]
  17.  
  18. if args[3] ~= nil then
  19. position = args[3]
  20. end
  21.  
  22. cmd = cmd .. "Mining"
  23.  
  24. print("Sending command " .. cmd .. " to turtle " .. turtleId .. " on " .. position .. " modem.")
  25. rednet.open(position)
  26.  
  27. while true do
  28. rednet.send(turtleId, cmd)
  29. local senderId, message = rednet.receive(0.5)
  30. if message == "acknowledged" then
  31. break
  32. end
  33.  
  34. os.sleep(0.1)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement