Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setCursorPos(1, 19)
- term.clear()
- rednet.open("bottom")
- local nickname = "User"
- local receiverID = nil
- write("Nickname: ")
- input = read()
- nickname = input
- term.clear()
- print("Your ID - "..os.getComputerID())
- write("Server ID: ")
- input = read()
- receiverID = tonumber(input)
- rednet.send(receiverID, "Pinging")
- recID, msg, connected = rednet.receive()
- if msg == "Pinged" and connected then
- print("Connected To Server "..recID)
- else
- print("Failed To Connect.")
- print("Press Any Key To Reboot")
- os.pullEvent("key")
- os.reboot()
- end
- term.clear()
- term.setCursorPos(1, 19)
- local function receive()
- senderID, msg, nick = rednet.receive()
- term.setTextColor(colors.white)
- print(nick..": "..msg)
- end
- local function send()
- term.setCursorPos(1, 19)
- term.setTextColor(colors.gray)
- rednet.send(receiverID, read(), nickname)
- end
- while true do
- term.setCursorPos(1, 1)
- term.setTextColor(colors.blue)
- print("Redhost Chat Program 1.0 - By BJ Rafferty")
- print("ID - "..os.getComputerID())
- term.setTextColor(colors.white)
- parallel.waitForAny(receive, send)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement