View difference between Paste ID: JFzPQLi7 and nBd0N3Fs
SHOW: | | - or go back to the newest paste.
1-
local glasses = peripheral.wrap("top")
1+
local glasses = peripheral.wrap("right")
2-
glasses.clear()
2+
rednet.open("top")
3
4-
glasses.addBox(5,5,50,50,0x000000,0.2)
4+
reactor = 16
5-
glasses.addText(10,10,"Reactor",0x00BFFF)
5+
6
-- Create box
7-
glasses.sync()
7+
function createBox()
8
	glasses.clear()
9
	glasses.addBox(5,20,50,50,0x000000,0.2)
10
	glasses.addText(10,25,"Reactor",0x385E9C)
11
	glasses.sync()
12
end
13-
		if event[5] == "test" then
13+
14-
			glasses.clear()
14+
-- Default status
15-
			glasses.addBox(5,5,50,50,0xFFFFFF,1)
15+
function default()
16-
			glasses.addText(10,10,"WORKING",0x00BFFF)
16+
	rednet.send(reactor,"roff")
17-
			glasses.sync()
17+
	glasses.addText(10,35,"Offline",0x9C3838)
18
	glasses.sync()
19
end
20
21
-- Get status
22
function status()
23
	rednet.send(reactor,"status")
24
	id, stat = rednet.receive(5)
25
 
26
    if stat == true then
27
		glasses.clear()
28
        createBox()
29
		glasses.addText(10,35,"Online",0x389C51)
30
		glasses.sync()
31
    elseif stat == false then
32
		glasses.clear()
33
        createBox()
34
		glasses.addText(10,35,"Offline",0x9C3838)
35
		glasses.sync()
36
	else
37
		default()
38
    end
39
end
40
41
createBox()
42
status()
43
44
-- Commands
45
while true do
46
	local event = { os.pullEvent() }
47
48
	if event[1] == "glasses_chat_command" then
49
		if event[5] == "ron" then
50
			rednet.send(reactor,"ron")
51
			sleep(1)
52
			status()
53
		elseif event[5] == "roff" then
54
			rednet.send(reactor,"roff")
55
			sleep(1)
56
			status()
57
		end
58
	end
59
end