Advertisement
Himeki

Rednet Example

Jul 26th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --remote terminal program
  2. while true do
  3.     term.clear()
  4.     term.setCursorPos(1,1)
  5.     write("Enter Password: ")
  6.     sPassword = tostring(read())
  7.     if sPassword == "Open Sesame" then
  8.         rednet.send ( nDoorId, "safe to open" ) --nDoorId is the ID # of the door's computer
  9.     end
  10. end
  11.  
  12.  
  13.  
  14.  
  15. --door program
  16. while true do
  17.     ID, message = rednet.receive ( 5 )
  18.     if ID == safeID and message == "safe to open" then --safeID being the remote terminal's ID #
  19.         --do door opening code
  20.     else
  21.         os.sleep(0.5)
  22.     end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement