Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("WARNING...")
- w,h = term.getSize()
- lineno = 1
- rednet.open("back")
- function listenForMessages()
- while true do
- local id, msg = rednet.receive()
- if lineno == 16 then lineno = 1 end
- local oldx,oldy = term.getCursorPos()
- term.setCursorPos(1, lineno)
- term.clearLine()
- if string.find(msg, "::") then
- term.write(string.gsub(msg, "::", ":"))
- else
- term.write(id..":"..msg)
- end
- term.setCursorPos(oldx, oldy)
- end
- lineno = lineno + 1
- end
- function sendMessages()
- term.setCursorPos(1, h-1)
- while true do
- message = io.read()
- if message == "quit" then break end
- rednet.broadcast(os.getComputerLabel().."::"..message)
- term.setCursorPos(1, lineno)
- term.write(os.getComputerLabel()..":"..message)
- lineno = lineno + 1
- term.setCursorPos(1, h-1)
- term.clearLine()
- end
- end
- term.clear()
- term.setCursorPos(1, h-2)
- term.write(string.rep("*", w))
- parallel.waitForAny(sendMessages,
- listenForMessages)
Advertisement
Add Comment
Please, Sign In to add comment