SHARE
TWEET

ComputerCraft Tutorial: radio_ctrl(turtle)0_1

hevohevo Jan 11th, 2014 943 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- ############################################
  2. -- radio_ctrl  (turtle side)
  3. -- version 0.1
  4. -- http://hevohevo.hatenablog.com/
  5. --   1. Refer to controller side program (http://pastebin.com/uJfWnku6).
  6. --   2. Input to the following and reboot TurtleOS
  7. --     > pastebin get 0ian5ggx startup
  8.  
  9. -- ################## config ##################
  10. ModemSide = "right"
  11. ControllerID = nil -- set id, if you need to restrict controller ID.
  12.  
  13. -- ################## main ####################
  14. rednet.open(ModemSide)
  15.  
  16. function eval(str)
  17.   assert(loadstring(str))()
  18. end
  19.  
  20. while true do
  21.   local sender_id, message, distance = rednet.receive()
  22.   if not ControllerID or (sender_id == ControllerID) then eval(message) end
  23. end
RAW Paste Data
Top