SHOW:
|
|
- or go back to the newest paste.
| 1 | for a,b in pairs(rs.getSides()) do | |
| 2 | if peripheral.getType(b) == "modem" then | |
| 3 | rednet.open(b) | |
| 4 | break | |
| 5 | end | |
| 6 | end | |
| 7 | ||
| 8 | - | _setOutput = new function(side) |
| 8 | + | function _setOuput(side) |
| 9 | rs.setOutput(side, true) | |
| 10 | sleep(1) | |
| 11 | rs.setOutput(side, false) | |
| 12 | end | |
| 13 | ||
| 14 | while true do | |
| 15 | ||
| 16 | - | id, message, protocol = rednet.receive() |
| 16 | + | id, message, protocol = rednet.receive() |
| 17 | - | if message == "SET_TO_DAY" then |
| 17 | + | if protocol == "SarasMessage Protocol" then |
| 18 | - | print("Setting to day")
|
| 18 | + | if message == "SET_TO_DAY" then |
| 19 | - | rednet.send(id, "Message Received", "ResponseProtocol1") |
| 19 | + | print("Setting to day")
|
| 20 | - | _setOutput("left")
|
| 20 | + | rednet.send(id, "Message Received", "ResponseProtocol1") |
| 21 | - | else if message == "SET_TO_CLEAR" then |
| 21 | + | _setOutput("left")
|
| 22 | - | print("Setting the weather to clear")
|
| 22 | + | else if message == "SET_TO_CLEAR" then |
| 23 | - | rednet.send(id, "Message Received", "ResponseProtocol1") |
| 23 | + | print("Setting the weather to clear")
|
| 24 | - | _setOutput("right")
|
| 24 | + | rednet.send(id, "Message Received", "ResponseProtocol1") |
| 25 | _setOutput("right")
| |
| 26 | end | |
| 27 | end | |
| 28 | end | |
| 29 | end |