Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables
- thisUser = tostring(accN)
- thisPass = tostring(accP) --Set up pass on other program
- name = "Skype"
- ver = "Alpha 1.6"
- local muT = "Username: " --menu username text
- local mpT = "Password: " --menu password text
- w,h = term.getSize()
- id = os.getComputerID()
- yPos = 4
- rXpos = 1 -- When receiving messages
- sXpos = w -- When sending them
- --Tables
- local nathan = {62; "12/9/15";} --id, setupdate
- local sean = {63; "12/9/15";} --id, setupdate
- --Functions
- local function drawTb()
- term.setCursorPos(1,1)
- term.setTextColor(1)
- term.setBackgroundColor(colors.blue)
- term.clearLine()
- print(name)
- term.setCursorPos(math.floor(w)-#ver,1)
- print(ver)
- end
- local function bground()
- term.setCursorPos(1,1)
- term.setBackgroundColor(1)
- term.clear()
- term.setCursorPos(22,2)
- term.setTextColor(colors.red)
- print("MESSAGES")
- end
- local function listen()
- term.setBackgroundColor(1)
- term.setTextColor(colors.red)
- term.setCursorPos(1,yPos)
- while true do
- id, message = rednet.receive()
- if id == 63 then
- sender = "Sean"
- term.setTextColor(colors.cyan)
- term.setCursorPos(rXpos,yPos)
- yPos = yPos + 1
- print("<"..sender.."> "..message)
- elseif id == 62 then
- sender = "Nathan"
- term.setTextColor(colors.orange)
- term.setCursorPos(rXpos,yPos)
- yPos = yPos + 1
- print("<"..sender.."> "..message)
- end
- end -- could insert userMessage() here?
- end
- local function textBar()
- term.setCursorPos(1,18)
- term.setBackgroundColor(colors.lightBlue)
- term.clearLine()
- term.setTextColor(colors.green)
- end
- local function userMessage()
- while true do
- textBar()-- change this to term.setCursorPos(1,18)
- term.setCursorPos(1,18)
- term.clearLine()
- term.write(">")
- term.setCursorPos(2,18)
- uMessage = read()
- rednet.send(63,uMessage)
- rednet.send(62,uMessage)
- term.setCursorPos(math.floor(w)-#uMessage,yPos)
- yPos = yPos + 1
- term.setTextColor(colors.purple)
- term.setBackgroundColor(colors.white)
- print(uMessage)
- end
- end
- local function login()
- term.setTextColor(1)
- term.setBackgroundColor(colors.cyan)
- term.setCursorPos(w/2-#muT,(h/2)-3)
- term.clear()
- term.write("Username: ")
- local input1 = read()
- term.setCursorPos(w/2-#mpT,(h/2)+1)
- term.write("Password: ")
- local input2 = read("*")
- if input1 == thisUser and input2 == thisPass then
- bground()
- drawTb()
- else
- login()
- end
- end
- --Main code
- login()
- rednet.open("top")
- --bground() --These lines are in use
- --drawTb() --These lines are in use
- textBar()
- --listen()
- userMessage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement