View difference between Paste ID: 2gJx0MGT and N6HduU5a
SHOW: | | - or go back to the newest paste.
1
foundMonitor = false
2
mw, mh = 0
3
spawners = {}
4
spawners[0] = false
5
spawners[1] = true
6
red = 16384
7
green = 32
8-
function drawBox(x,y,w,h,c)
8+
function drawBox(x,y,w,h,c, label)
9
	i = x
10
	_w = w + x
11
	_h = h+y
12
	while i < _w do
13
	j = y
14
		while j < _h do
15
			paintutils.drawPixel(i,j,c)
16
			j = j+1
17
		end
18
	i = i+1
19
	end
20
	mon.setCursorPos(x,y)
21
	mon.write(label)
22
end
23
function drawGUI()
24-
		drawBox(3,3,10,6, red)
24+
25
	if spawners[0] == false then
26-
		drawBox(3,3,10,6, green)
26+
		drawBox(3,3,10,6, red, "OFF")
27
	else
28
		drawBox(3,3,10,6, green, "ON")
29
	end
30-
		drawBox(3,12,10,6, red)
30+
31
	if spawners[1] == false then
32-
		drawBox(3,12,10,6, green)
32+
		drawBox(3,12,10,6, red, "OFF")
33
	else
34
		drawBox(3,12,10,6, green, "ON")
35
	end
36
37
end
38
function update()
39
if spawners[0] == true then spawners[0] = false
40
else spawners[0] = true
41
end
42
43
function init()
44
if peripheral.isPresent("bottom") then	
45
	mon = peripheral.wrap("bottom")
46
	mw, mh = mon.getSize()
47
	mon.setBackgroundColor(1)
48
	mon.clear()
49
	term.redirect(mon)
50
	foundMonitor = true
51
else
52
	foundMonitor = false
53-
	--while true do 
53+
54
end
55
if foundMonitor == true then
56
	while true do 
57-
	--end
57+
58
		drawGUI()
59
		sleep(1)
60
	end
61
	term.restore()
62
end
63
end
64
65
init()