Advertisement
melzneni

RfDisplayWirelessCenter

Jun 9th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. rednet.open("left")
  2.  
  3. monitors={}
  4.  
  5. function len(txt)
  6. return #txt
  7. end
  8.  
  9. while true do
  10.  
  11. id,message,distance,protocol=rednet.receive("monitoring")
  12. if id~=nil then
  13. if message:sub(1,len("connectToServer:"))=="connectToServer:" then
  14. rednet.send(id,"successfullyConnected","monitoring")
  15. name=message:sub(len("connectToServer:")+1)
  16. print("successfullyConnected: "..id..", "..name)
  17. monitors[name]={id}
  18. rednet.send(id,"displayMsg:hu","monitoring")
  19. elseif message=="ping" then
  20. rednet.send(id,"successfullyPinged","monitoring")
  21. else
  22. print("unknown message: "..message)
  23. end
  24. end
  25.  
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement