Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Username = "Username"
- Password = "Password"
- local Hint = "[Insert Hint Here]"
- local function readN(len, replaceChar)
- len = len or 18
- local input = ""
- local key = 0
- term.setCursorBlink(true)
- repeat
- local e,p1 = os.pullEvent()
- if e == "char" then
- if #input < len then
- input = input..p1
- term.write(replaceChar or p1)
- end
- elseif e == "key" and p1==keys.backspace and #input > 0 then
- input = input:sub(1,#input-1)
- local x,y = term.getCursorPos()
- term.setCursorPos(x-1,y)
- term.write(" ")
- term.setCursorPos(x-1,y)
- end
- until p1==keys.enter
- term.setCursorBlink(false)
- return input
- end
- local version = "v1.3"
- term.clear()
- term.setCursorPos(13,7)
- term.setTextColor(colors.purple)
- print("EnderOS "..version.." Initializing")
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.lime)
- for i = 14, 36 do
- term.setCursorPos(i,9)
- term.write(" ")
- sleep(0.3)
- end
- term.setBackgroundColor(colors.black)
- sleep(1)
- function screen()
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.lime)
- print("+-------------------------------------------------+")
- print("| |")
- print("| ")
- term.setCursorPos(19,3)
- term.setTextColor(colors.purple)
- print("EnderOS v1.3")
- term.setTextColor(colors.lime)
- term.setCursorPos(31,3)
- print(" |")
- print("| |")
- print("| |")
- print("| |")
- print("| |")
- print("| ")
- term.setCursorPos(10,8)
- term.setTextColor(colors.orange)
- print("Username:")
- term.setCursorPos(19,8)
- print(" ")
- term.setCursorPos(50,8)
- term.setTextColor(colors.lime)
- print(" |")
- print("| |")
- print("| ")
- term.setTextColor(colors.orange)
- term.setCursorPos(10,10)
- print("Password:")
- term.setCursorPos(19,10)
- print(" ")
- term.setCursorPos(50,10)
- term.setTextColor(colors.lime)
- print(" |")
- print("| |")
- print("| |")
- print("| ")
- term.setCursorPos(8,13)
- term.setTextColor(colors.blue)
- print("forgot password ")
- term.setCursorPos(50,13)
- term.setTextColor(colors.lime)
- print(" |")
- print("| |")
- print("| |")
- print("| |")
- print("| |")
- print("| |")
- term.write("+-------------------------------------------------+")
- end
- screen()
- function click()
- local event, button, xPos, yPos = os.pullEvent("mouse_click")
- if button == 1 then
- if (xPos >= 8 and xPos <= 22 and yPos == 13) then
- term.setCursorPos(10,14)
- print("Hint: "..Hint)
- click()
- elseif (xPos >=10 and xPos <= 18 and yPos == 8) then
- term.setCursorPos(20,8)
- else
- click()
- end
- else
- screen()
- click()
- end
- end
- function login()
- click()
- term.setTextColor(colors.white)
- input = read()
- if input == (Username) then
- term.setCursorPos(8,8)
- term.setTextColor(colors.lime)
- term.write("O")
- term.setTextColor(colors.white)
- term.setCursorPos(20,10)
- input = read()
- if input == (Password) then
- term.setCursorPos(8,10)
- term.setTextColor(colors.lime)
- term.write("O")
- term.setTextColor(colors.white)
- sleep(0.8)
- term.clear()
- term.setCursorPos(20,8)
- print("Logging in")
- term.setCursorPos(30,8)
- sleep(0.7)
- print(".")
- sleep(0.7)
- term.setCursorPos(31,8)
- print(".")
- sleep(0.7)
- term.setCursorPos(32,8)
- print(".")
- sleep(0.7)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.purple)
- term.write("EnderOS "..version)
- term.setCursorPos(1,2)
- else
- term.setCursorPos(8,10)
- term.setTextColor(colors.red)
- term.write("X")
- sleep(0.5)
- term.setTextColor(colors.white)
- screen()
- login()
- end
- else
- term.setCursorPos(8,8)
- term.setTextColor(colors.red)
- term.write("X")
- sleep(0.5)
- term.setTextColor(colors.white)
- screen()
- login()
- end
- end
- login()
Advertisement
Add Comment
Please, Sign In to add comment