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 | - | color[on] = "0x2290000" |
9 | + | color["on"] = "0x2290000" |
10 | - | color[off] = "0xFF0000" |
10 | + | color["off"] = "0xFF0000" |
11 | ||
12 | -- Devices | |
13 | - | local devices = {Quarry} |
13 | + | local devices = { "Quarry" } |
14 | ||
15 | -- Device status | |
16 | local status = {} | |
17 | for i, device in ipairs( devices ) do | |
18 | - | status[device] = glass.addText( pos_x, pos_y, device, status[off] ) |
18 | + | status[device] = glass.addText( pos_x, pos_y, device, status["off"] ) |
19 | pos_y = pos_y + pos_inc | |
20 | end | |
21 | ||
22 | - | statusQuarry = glass.addText( 40, 55, "Quarry", 0xFF0000 ) |
22 | + | |
23 | local command = "" | |
24 | local device = "" | |
25 | local status = "" | |
26 | ||
27 | senderID, message, distance = rednet.receive() | |
28 | print( senderID .. ": " .. message ) | |
29 | ||
30 | for i in string.gmatch( message, "%S+" ) do | |
31 | if not command then | |
32 | command = i | |
33 | elseif not device then | |
34 | device = i | |
35 | else | |
36 | status = i | |
37 | end | |
38 | end | |
39 | ||
40 | status[device].setColor( color[status] ) | |
41 | end | |
42 | ||
43 | rednet.close( "back" ) |