Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- term.clear()
- local username = ("Anon"..tostring(math.random(1,10000)))
- local usernameSet = false
- textutils.slowWrite("--------------------------------\n", 50)
- textutils.slowWrite(" Welcome to Abu Chat - v0.1 \n", 50)
- textutils.slowWrite("--------------------------------\n\n", 50)
- print("Press \"t\" to Type\n")
- function resTerm()
- term.clear()
- term.setCursorPos(1,1)
- print("--------------------------------\n")
- print(" Welcome to Abu Chat - v0.1 \n")
- print("--------------------------------\n\n")
- print("Press \"t\" to Type\n")
- end
- function mainLoop()
- while true do
- event, id, msg = os.pullEvent()
- if event == "char" then
- if id == "t" then
- msg = read()
- rednet.broadcast(textutils.formatTime(os.time(), false).." "..username..": "..msg)
- end
- end
- end
- end
- function listen()
- while true do
- event, id, msg = os.pullEvent()
- if event == "rednet_message" then
- print(msg)
- end
- end
- end
- parallel.waitForAll(listen, mainLoop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement