SHOW:
|
|
- or go back to the newest paste.
1 | - | glass = peripheral.wrap("bottom") |
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"] = "0x229000" |
10 | + | color["on"] = 0x229000 |
11 | - | color["off"] = "0xFF0000" |
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 | - | print( "Adding " .. device .. " as " .. color["off"] ) |
19 | + | |
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 | string = split( message, " " ) | |
32 | command = string[1] | |
33 | device = string[2] | |
34 | status = string[3] | |
35 | ||
36 | for i in string.gmatch( message, "%S+" ) do | |
37 | if not command then | |
38 | command = i | |
39 | elseif not device then | |
40 | device = i | |
41 | else | |
42 | status = i | |
43 | end | |
44 | end | |
45 | ||
46 | status[device].setColor( color[status] ) | |
47 | end | |
48 | ||
49 | rednet.close( "back" ) |