Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top") -- it will use the wireless modem located on the top
- --(you can also use left , right , top , down , front, back)
- message = 0
- monitor = peripheral.wrap("right")
- print("Computer ID: "..os.getComputerID())
- print("Listening...")
- function checkMessage() -- start of function
- if message == "RUNNING" then
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.setTextColor(1)
- monitor.write("Quarry")
- monitor.setCursorPos(1,2)
- monitor.setTextColor(8192)
- monitor.write("Running")
- print("Quarry - Running")
- elseif message == "NORUNNING" then
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.setTextColor(1)
- monitor.write("Quarry")
- monitor.setCursorPos(1,2)
- monitor.setTextColor(16384)
- monitor.write("Not running")
- print("Quarry - Not Running")
- end
- end
- repeat
- event,p1,p2,p3 = os.pullEvent()
- -- this line above says wait for an event to happen
- if event == "rednet_message" then
- -- if the event is a rednet_message then run this
- message=p2 -- overwrites our message variable
- checkMessage() -- this calls our function above
- end
- until event == "char" and p1 == "x"
- -- this is the ending for the repeat it will stop the loop
- -- 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