Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local compID = 0
- local message = ""
- local chatName = ""
- function help()
- print("Please type the following commands to perform the described function:")
- print("Type /name to enter the name change function")
- print("Type /id to enter the ID change function")
- print("Type /clearscreen to clear the chat client screen")
- print("Type /clearscreenr to clear the receival monitor screen")
- print("Type /reboot to restart the client machine")
- print("Type /rebootr to restart the receival machine")
- return
- end
- function name(name)
- print("Please enter desired chat name: ")
- name = read()
- return name
- end
- function id(id)
- print("Please enter ID of receiving server: ")
- id = read()
- return id
- end
- function clearscreen()
- term.clear()
- term.setCursorPos(1,1)
- return
- end
- function clearscreenr(id)
- rednet.send(tonumber(id), "()clear()")
- return
- end
- function reboot()
- os.reboot()
- return
- end
- function rebootr(id)
- rednet.send(tonumber(id), "()reboot()")
- return
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Welcome to the chat client!\n")
- compID = id(compID)
- term.clear()
- term.setCursorPos(1,1)
- chatName = name(chatName)
- term.clear()
- term.setCursorPos(1,1)
- rednet.open ("top")
- print("Type /help for a list of commands\n")
- while true do
- print("Enter Message: ")
- message = read()
- if message == "/help" then
- help()
- elseif message == "/name" then
- chatName = name(chatName)
- elseif message == "/id" then
- compID = id(compID)
- elseif message == "/clearscreen" then
- clearscreen()
- elseif message == "/clearscreenr" then
- clearscreenr(compID)
- elseif message == "/reboot" then
- reboot()
- elseif message == "/rebootr" then
- rebootr(compID)
- else
- rednet.send (tonumber(compID), (chatName)..":")
- sleep (0.08)
- rednet.send (tonumber(compID), (message))
- sleep (0.08)
- rednet.send (tonumber(compID), "-----------------------------")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement