computercam

MessageBoard_CCDOMAIN

May 11th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. m = peripheral.wrap("right")
  2. rednet.open("top")
  3. serverID = 2
  4. connected = false
  5. os.loadAPI("APIs/server")
  6. --FUNCTIONS
  7. local function clear()
  8. m.clear()
  9. m.setCursorPos(1, 1)
  10. end
  11. server.TestConnection()
  12. server.connect("monitor", "password-monitor-password")
  13. senderID, message, distance = rednet.receive()
  14. if message == "login" then
  15. print("Connection done!")
  16. connected = true
  17. else
  18. print("Fail")
  19. end
  20. while connected do
  21. local senderID, message, distance = rednet.receive()
  22. print("Getting message.")
  23. print(message)
  24. if message == "anyMonitors" then
  25. rednet.broadcast("monitor")
  26. end
  27. if message == "sendTo" then
  28. print(senderID, ": Requesting data... Waiting for sender.")
  29. senderID, message, distance = rednet.receive()
  30. print(senderID, ": Sent message: ", message)
  31. clear()
  32. m.write(message)
  33. end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment