Advertisement
D4Programs

Listener

Apr 11th, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. local printer = peripheral.wrap("right")
  2. local modem = peripheral.wrap("top")
  3. while true do
  4. --Snooper
  5. modem.open(65533)
  6. ID, message, protocol = rednet.receive()
  7. print("Message Details")
  8. print("Sender ID: #" ..ID)
  9. print("Protocol: " ..protocol)
  10. print("Message: " ..message)
  11. --Printing
  12. local ready = printer.newPage()
  13. if ready == true then
  14. print("Do you want to print this message? Y/N")
  15. response = read()
  16. if response == "Y" then
  17. print("Who will receive this?")
  18. target = read()
  19. printer.setCursorPos(1,1)
  20. printer.write("Message Details")
  21. printer.setCursorPos(1,3)
  22. printer.write("Sender ID: #" ..ID)
  23. printer.setCursorPos(1,4)
  24. printer.write("Protocol: " ..protocol)
  25. printer.setCursorPos(1,6)
  26. printer.write("Message")
  27. printer.setCursorPos(1,7)
  28. printer.write(message)
  29.  
  30. printer.setPageTitle("Send to " ..target)
  31. printer.endPage()
  32. else
  33. term.clear()
  34. term.setCursorPos(1,1)
  35. end
  36. else
  37. print("Printer isn't ready. Check ink and paper")
  38. end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement