View difference between Paste ID: XwQVe9J7 and xkiPvDdX
SHOW: | | - or go back to the newest paste.
1
m = peripheral.wrap("right")
2
function Mprint(txt)
3
	color = 2^math.random(1,16)
4
	term.setTextColor(color)
5
	print(txt)
6
	term.setTextColor(colors.white)
7
8
end
9
function Mwrite(txt)
10
	color = 2^math.random(1,16)
11
	term.setTextColor(color)
12
	write(txt)
13
	term.setTextColor(colors.white)
14
15
end
16
17
18
while true do
19-
	for i= 1,#name
19+
20-
		print(name[i]..": "..msg[i]
20+
21
	msg =  textutils.unserialize(h.readLine())
22
	h.close()
23
	term.redirect(m)
24
	term.clear()
25
	term.setCursorPos(1,1)
26
	for i= 1,#name do
27
		Mwrite(name[i]..": ")
28
	 	Mprint(msg[i])
29
		
30
	end
31
	term.restore()
32
	term.clear()
33
	term.setCursorPos(1,5)
34
	Mprint("Name: "
35
	n= read()
36
	Mprint("\n\nText:")
37
	m = read()
38
	fs.delete("chat.txt")
39
	h = fs.open("chat.txt","w")
40
	table.insert(name,n)
41
	table.insert(msg,m)
42
	h.writeLine(textutils.serialize(name))
43
	h.writeLine(textutils.serialize(msg))
44
	h.close()
45
end