Advertisement
blaize9

QuarryStatus-Receiver-Monitor

Aug 28th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. rednet.open("top") -- it will use the wireless modem located on the top
  2. --(you can also use left , right , top , down , front, back)
  3. message = 0
  4. monitor = peripheral.wrap("right")
  5.  
  6. print("Computer ID: "..os.getComputerID())
  7. print("Listening...")
  8. function checkMessage() -- start of function
  9. if message == "RUNNING" then
  10. monitor.clear()
  11. monitor.setCursorPos(1,1)
  12. monitor.setTextColor(1)
  13. monitor.write("Quarry")
  14. monitor.setCursorPos(1,2)
  15. monitor.setTextColor(8192)
  16. monitor.write("Running")
  17. print("Quarry - Running")
  18. elseif message == "NORUNNING" then
  19. monitor.clear()
  20. monitor.setCursorPos(1,1)
  21. monitor.setTextColor(1)
  22. monitor.write("Quarry")
  23. monitor.setCursorPos(1,2)
  24. monitor.setTextColor(16384)
  25. monitor.write("Not running")
  26. print("Quarry - Not Running")
  27. end
  28. end
  29.  
  30. repeat
  31. event,p1,p2,p3 = os.pullEvent()
  32. -- this line above says wait for an event to happen
  33. if event == "rednet_message" then
  34. -- if the event is a rednet_message then run this
  35. message=p2 -- overwrites our message variable
  36. checkMessage() -- this calls our function above
  37. end
  38. until event == "char" and p1 == "x"
  39. -- this is the ending for the repeat it will stop the loop
  40. -- if a character is pressed on your keyboard, if it is an X then stop the repeat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement