Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArgs = {...}
- --Umbra - 1.5 Enabled IRC Chat
- --Designed and coded by LDShadowLord, for use by the CCU server.
- --Making it look purty
- verrbar = "==VERR============================================="
- umbrabar = "Umbra, the VERR default chat application!"
- commands = "Use /<command> to use commands!"
- --Defining some Variables
- w,h = term.getSize()
- --Wrapping to the modem, change the value if your modem is not located on the top.
- modem = peripheral.wrap("top")
- --Opening the two channels that we will be operating on.
- local sendChannel = 016613
- local replyChannel = 026613
- modem.open(sendChannel) --Channel to send on
- modem.open(replyChannel) --Channel to receive on
- --Opening servers
- --local CCUserver = 654321
- --local VerrDef1 = 016613
- --local VerrDef2 = 026613
- --modem.open(CCUserver)
- --modem.open(VerrDef1)
- --modem.open(VerrDef2)
- --Defining a 'Login' function.
- local function login()
- local id = os.getComputerID()
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print(verrbar)
- print(umbrabar)
- print("Hello! Please enter your name to use this program!")
- input = read()
- if input == "" then
- print("I am sorry, but that is not a valid username :( ")
- login()
- else
- print("Hello, "..input.."! We will now redirect you to the server screen!")
- modem.transmit(sendChannel, replyChannel, input.." has logged in from ID: "..id)
- sleep(2)
- term.clear()
- term.setCursorPos(1, h-2)
- term.write(string.rep("*", w))
- parallel.waitForAny(sendMessages, listenForMessages)
- end
- end
- end
- local function listenForMessages()
- while true do
- local id, msg = rednet.receive()
- if h == 16 then
- term.setCursorPos(1,1)
- end
- local oldx,oldy = term.getCursorPos()
- term.setCursorPos(1, w + 1)
- term.clearLine()
- if string.find(msg, "::") then
- term.write(string.gsub(msg, "::", ":"))
- else
- term.write(id..":"..msg)
- end
- term.setCursorPos(oldx, oldy)
- end
- end
- local function sendMessages()
- term.setCursorPos(1, h-1)
- while true do
- message = io.read()
- if message == "/exit" then
- break
- end
- modem.transmit(sendChannel, replyChannel, os.getComputerLabel().."::"..message)
- term.setCursorPos(1, h + 1)
- print(os.getComputerLabel()..":"..message)
- term.setCursorPos(1, h-1)
- term.clearLine()
- end
- end
- login()
Advertisement
Add Comment
Please, Sign In to add comment