Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- term.clear()
- term.setCursorPos(1,1)
- channel = "-"
- function readMsg()
- while true do
- id, msg = rednet.receive()
- if string.sub(msg, 1, string.len("[".. channel .."]")) == "[".. channel .."]" then
- print(msg)
- end
- end
- end
- function writeMsg()
- while true do
- term.setCursorPos(1,18)
- write("")
- input = read()
- term.setCursorPos(1,17)
- term.clearLine()
- write("["..channel.."] " ..input)
- if input == "/quit" then
- shell.run("clear")
- break
- elseif input == "/clear" then
- shell.run("clear")
- else
- rednet.broadcast("[".. channel .."] ".. input)
- end
- end
- end
- while true do
- parallel.waitForAny(readMsg, writeMsg)
- end
Advertisement
Add Comment
Please, Sign In to add comment