SHOW:
|
|
- or go back to the newest paste.
1 | - | local unicode = require('unicode') |
1 | + | |
2 | local fs = require('filesystem') | |
3 | - | local term = require('term') |
3 | + | |
4 | - | local shell=require("shell") |
4 | + | |
5 | local rs = component.redstone | |
6 | local running = true | |
7 | - | local gpu = component.gpu |
7 | + | |
8 | -- Callbacks | |
9 | local function networkCallback(type, myaddr, senderaddress, port, distance, message) | |
10 | -- print(myaddr .. " " .. senderaddress .. " " .. port .. " " .. distance .. " " .. message) | |
11 | - | -- Colors |
11 | + | if port == 123 then |
12 | - | local backcolor = 0x000000 |
12 | + | if message == "on" then |
13 | - | local forecolor = 0xFFFFFF |
13 | + | for k,v in component.list() do |
14 | if v == "colorful_lamp" then | |
15 | - | local buttonbg = 0x444444 |
15 | + | component.proxy(k).setLampColor(31744) |
16 | - | local buttonselectedbg = 0x626262 |
16 | + | end |
17 | - | local buttontext = 0xC5C8C6 |
17 | + | |
18 | elseif message == "off" then | |
19 | - | local selection = 0xF0544C |
19 | + | for k,v in component.list() do |
20 | if v == "colorful_lamp" then | |
21 | - | local infocolor = 0x0066FF |
21 | + | component.proxy(k).setLampColor(0) |
22 | - | local errorcolor = 0xFF0000 |
22 | + | end |
23 | end | |
24 | end | |
25 | - | -- Constants |
25 | + | |
26 | - | local myname = "XDjackieXD" |
26 | + | |
27 | ||
28 | - | -- Gui |
28 | + | |
29 | - | local oldwidth, oldheight = gpu.getResolution() |
29 | + | |
30 | - | local oldbgcolor = gpu.getBackground() |
30 | + | |
31 | - | local oldfgcolor = gpu.getForeground() |
31 | + | |
32 | - | local width = 10 |
32 | + | |
33 | - | local height = 20 |
33 | + | event.listen("modem_message", networkCallback) |
34 | - | local buttons = {} |
34 | + | |
35 | while running do | |
36 | - | gpu.setResolution(width, height) |
36 | + | |
37 | - | gpu.setForeground(forecolor) |
37 | + |