SHOW:
|
|
- or go back to the newest paste.
| 1 | glass = peripheral.wrap("bottom")
| |
| 2 | ||
| 3 | rednet.open( "back" ) | |
| 4 | ||
| 5 | -- Constants | |
| 6 | pos_x = 40 | |
| 7 | pos_y = 55 | |
| 8 | pos_inc = 10 | |
| 9 | local color = {}
| |
| 10 | - | color["on"] = "0x2290000" |
| 10 | + | color["on"] = "0x229000" |
| 11 | color["off"] = "0xFF0000" | |
| 12 | ||
| 13 | -- Devices | |
| 14 | local devices = { "Quarry" }
| |
| 15 | ||
| 16 | -- Device status | |
| 17 | local status = {}
| |
| 18 | for i, device in ipairs( devices ) do | |
| 19 | - | status[device] = glass.addText( pos_x, pos_y, device, status["off"] ) |
| 19 | + | status[device] = glass.addText( pos_x, pos_y, device, color["off"] ) |
| 20 | pos_y = pos_y + pos_inc | |
| 21 | end | |
| 22 | ||
| 23 | while true do | |
| 24 | local command = "" | |
| 25 | local device = "" | |
| 26 | local status = "" | |
| 27 | ||
| 28 | senderID, message, distance = rednet.receive() | |
| 29 | print( senderID .. ": " .. message ) | |
| 30 | ||
| 31 | for i in string.gmatch( message, "%S+" ) do | |
| 32 | if not command then | |
| 33 | command = i | |
| 34 | elseif not device then | |
| 35 | device = i | |
| 36 | else | |
| 37 | status = i | |
| 38 | end | |
| 39 | end | |
| 40 | ||
| 41 | status[device].setColor( color[status] ) | |
| 42 | end | |
| 43 | ||
| 44 | rednet.close( "back" ) |