Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. local monitor = peripheral.wrap("right")
  2. rednet.open("left")
  3.  
  4. function write_to_screen(sender, function)
  5. monitor.term.setTextColor(colors.white)
  6. monitor.write("Received message from: ")
  7.  
  8. monitor.term.setTextColor(colors.green)
  9. monitor.write(sender)
  10.  
  11. monitor.term.setTextColor(colors.white)
  12. monitor.write(", with message: ")
  13.  
  14. monitor.term.setTextColor(colors.gray)
  15. monitor.write(sender)
  16. end
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23. --Main
  24. rednet.host("servers", "main")
  25.  
  26. --Infinite main loop
  27. while true do
  28. local senderId, message, protocol = rednet.receive()
  29. write_to_screen(senderId, message)
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement