SHOW:
|
|
- or go back to the newest paste.
| 1 | local id = 57 | |
| 2 | rednet.open('back')
| |
| 3 | ||
| 4 | while true do | |
| 5 | os.pullEvent('mouse_click')
| |
| 6 | rednet.send(id,'','door') | |
| 7 | local errorT=0 | |
| 8 | local retValue=false | |
| 9 | repeat | |
| 10 | errorT=errorT+1 | |
| 11 | local pid,newValue,tag = rednet.receive(1) | |
| 12 | retValue=newValue | |
| 13 | until (pid==id and tag=='return') or errorT > 10 | |
| 14 | if errorT < 10 then | |
| 15 | if retValue then | |
| 16 | term.setTextColor(colors.yellow) | |
| 17 | print('Door Open')
| |
| 18 | else | |
| 19 | term.setTextColor(colors.green) | |
| 20 | print('Door Closed')
| |
| 21 | end | |
| 22 | else | |
| 23 | term.setTextColor(colors.red) | |
| 24 | print('Failed Response')
| |
| 25 | end | |
| 26 | end |