Advertisement
blaize9

QuarryStatus-Receiver

Aug 28th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 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.  
  5. print("Computer ID: "..os.getComputerID())
  6. print("Listening...")
  7. function checkMessage() -- start of function
  8. if message == "RUNNING" then
  9. print("Quarry - Running")
  10. elseif message == "NORUNNING" then
  11. print("Quarry - Not Running")
  12. end
  13. end
  14.  
  15. repeat
  16. event,p1,p2,p3 = os.pullEvent()
  17. -- this line above says wait for an event to happen
  18. if event == "rednet_message" then
  19. -- if the event is a rednet_message then run this
  20. message=p2 -- overwrites our message variable
  21. checkMessage() -- this calls our function above
  22. end
  23. until event == "char" and p1 == "x"
  24. -- this is the ending for the repeat it will stop the loop
  25. -- 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