View difference between Paste ID: 8RtK6WAJ and R7Qigub0
SHOW: | | - or go back to the newest paste.
1
local display = peripheral.find("monitor")
2
local screenWidth = display.getSize()
3
term.redirect(display)
4
5
rednet.open('top')
6
7
display.setTextScale(0.5)
8
9
local broadcastCat1 = "sorting"
10
local broadcastCat2 = "chatting"
11
local broadcastCat3 = "colors"
12
13
local header = window.create(display, 1, 1, 100, 1)
14
local cat1 = window.create(display, 1, 2, 100, 1) 
15
local body1 = window.create(display, 1, 3, 100, 10)
16
local cat2 = window.create(display, 1, 13, 100, 1)
17
local body2 = window.create(display, 1, 14, 100, 10)
18
local cat3 = window.create(display, 1, 24, 100, 1)
19
local body3 = window.create(display, 1, 25, 100, 10)
20
21
function setHeader(h, m)
22-
local cat3 = window.create(display, 1, 24, 100, 10)
22+
23
    h.setBackgroundColor(colors.gray)
24
    h.setTextColor(colors.black)
25
    h.write(m) 
26
end
27
28
function setBody(b, m)
29-
setBody(cat1, "init")
29+
30-
setBody(cat2, "init")
30+
31-
setBody(cat3, "init")
31+
32
    print(tostring(m))
33
end
34
35
function waitCat1()
36
	local ID, msg = rednet.receive(broadcastCat1)
37
38
	setBody(body1, ID .. ':'.. tostring(msg))
39
end
40
41
function waitCat2()
42
	local ID, msg = rednet.receive(broadcastCat2)
43
44
	setBody(body2, ID .. ':' .. tostring(msg))
45
end
46
47
function waitCat3()
48
	local ID, msg = rednet.receive(broadcastCat3)
49
50-
local ID, msg = rednet.receive(broadcastCat1)
50+
	setBody(body3, ID .. ':' .. tostring(msg))
51
end
52-
setBody(cat1, ID .. ':'.. tostring(msg))
52+
53
print("Debug starting...")
54
sleep(5)
55
display.clear()
56-
local ID, msg = rednet.receive(broadcastCat2)
56+
57
setHeader(header, "Debug Console")
58-
setBody(cat2, ID .. ':' .. tostring(msg))
58+
59
setHeader(cat2, "Chatting")
60
setHeader(cat3, "Text Color")
61
62-
local ID, msg = rednet.receive(broadcastCat3)
62+
setBody(body1, "init")
63
setBody(body2, "init")
64-
setBody(cat3, ID .. ':' .. tostring(msg))
64+
setBody(body3, "init")
65
66
while true do parallel.waitForAny(waitCat1, waitCat2, waitCat3) end
67