Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --os.pullEvent = os.pullEventRaw
- -- IGNOR ME!!
- shell.run("clear")
- -- Variables
- w, h = term.getSize()
- selection = 1
- maxSelection = 3
- -- Functions
- function clear ()
- term.clear()
- term.setCursorPos(1,1)
- end
- function OSSettings ()
- clear()
- term.setCursorPos(w/2-3-#RUN/2,1)
- print("Hello, "..RUN.."!")
- term.setCursorPos(w/2-12,2)
- print("Welcome Back To ConnOS!!")
- term.setCursorPos(1,3)
- for i=2,w do
- write("X")
- i = i + 1
- end
- term.setCursorPos(w/2-8,5)
- print("Change Password")
- term.setCursorPos(w/2-8,8)
- print("Change Username")
- term.setCursorPos(w/2-2,11)
- print("back")
- end
- function drawSelected ()
- clear()
- term.setCursorPos(w/2-3-#RUN/2,1)
- print("Hello, "..RUN.."!")
- term.setCursorPos(w/2-12,2)
- print("Welcome Back To ConnOS!!")
- term.setCursorPos(1,3)
- for i=2,w do
- write("X")
- i = i + 1
- end
- term.setCursorPos(w/2-8,5)
- print("CraftOS Command")
- term.setCursorPos(w/2-7,8)
- print("ConnOS Command")
- term.setCursorPos(w/2-4,11)
- print("Shutdown")
- if selection == 1 then
- term.setCursorPos(w/2-9,6)
- print("-----------------")
- getSelection()
- elseif selection == 2 then
- term.setCursorPos(w/2-8,9)
- print("----------------")
- getSelection()
- elseif selection == 3 then
- term.setCursorPos(w/2-5,12)
- print("----------")
- getSelection()
- end
- end
- function select()
- if selection == 1 then
- clear()
- term.setCursorPos(w/2-3-#RUN/2,1)
- print("Hello, "..RUN.."!")
- term.setCursorPos(w/2-12,2)
- print("Welcome Back To ConnOS!!")
- term.setCursorPos(1,3)
- for i=2,w do
- write("X")
- i = i + 1
- end
- term.setCursorPos(1,4)
- textutils.slowWrite("Command: ")
- input = read()
- textutils.slowWrite("Parameter: ")
- param = read()
- clear()
- shell.run(input, param)
- textutils.slowWrite("Press Enter When Finished")
- event, key = os.pullEvent("key")
- if key == 28 then
- drawSelected()
- end
- elseif selection == 2 then
- clear()
- term.setCursorPos(w/2-3-#RUN/2,1)
- print("Hello, "..RUN.."!")
- term.setCursorPos(w/2-12,2)
- print("Welcome Back To ConnOS!!")
- term.setCursorPos(1,3)
- for i=2,w do
- write("X")
- i = i + 1
- end
- drawSelected()
- elseif selection == 3 then
- os.reboot()
- end
- end
- -- GUI
- function login ()
- clear()
- term.setCursorPos(w/2-7,2)
- print("XXXXXXXXXXXXXX")
- term.setCursorPos(w/2-7,3)
- print("X X")
- term.setCursorPos(w/2-7,4)
- print("X UserName: X")
- term.setCursorPos(w/2-7,6)
- print("X X")
- term.setCursorPos(w/2-7,7)
- print("X Password: X")
- term.setCursorPos(w/2-7,9)
- print("X X")
- term.setCursorPos(w/2-7,10)
- print("XXXXXXXXXXXXXX")
- term.setCursorPos(w/2-6,5)
- end
- -- Login
- if fs.exists("ConnOS/Username") and fs.exists("ConnOS/Password") then
- login()
- file = io.open("ConnOS/Username")
- RUN = file:read()
- file:close()
- Uname = read()
- if Uname == RUN then
- file = io.open("ConnOS/Password")
- RPW = file:read()
- file:close()
- term.setCursorPos(w/2-6,8)
- Pword = read("#")
- if Pword == RPW then
- clear()
- term.setCursorPos(w/2-3-#RUN/2,1)
- textutils.slowPrint("Hello, "..RUN.."!")
- term.setCursorPos(w/2-12,2)
- textutils.slowPrint("Welcome Back To ConnOS!!")
- term.setCursorPos(1,3)
- for i=2,w do
- textutils.slowWrite("X")
- i = i + 1
- end
- else
- clear()
- print("Incorrect Password!")
- sleep(2)
- os.reboot()
- end
- else
- clear()
- print("Incorrect Username!")
- sleep(2)
- os.reboot()
- end
- else
- clear()
- textutils.slowPrint("Well Hello There!")
- sleep(3)
- clear()
- textutils.slowPrint("It appears that you are new to ConnOS!")
- sleep(3)
- clear()
- textutils.slowPrint("That's OK we'll just make a new User for you!")
- sleep(3)
- textutils.slowWrite("Please Enter A Username: ")
- Uname = read()
- fs.makeDir("ConnOS")
- file = io.open("Username","w")
- file:write(Uname)
- file:close()
- fs.move("Username", "ConnOS/Username")
- clear()
- print("Saving Username.")
- sleep(1)
- clear()
- print("Saving Username..")
- sleep(1)
- clear()
- print("Saving Username...")
- sleep(1)
- clear()
- print("Username Saved!")
- sleep(1)
- clear()
- textutils.slowPrint("Now let's make a Password!")
- sleep(3)
- textutils.slowWrite("Please Enter A Password: ")
- Pword = read("#")
- textutils.slowWrite("Please Confirm Your Password: ")
- P2 = read("#")
- if Pword == P2 then
- file = io.open("Password","w")
- file:write(Pword)
- file:close()
- fs.move("Password","ConnOS/Password")
- clear()
- print("Saving Password.")
- sleep(1)
- clear()
- print("Saving Password..")
- sleep(1)
- clear()
- print("Saving Password...")
- sleep(1)
- clear()
- print("Password Saved!")
- sleep(1)
- clear()
- textutils.slowPrint("Congradulations You Just Made A ConnOS Account!")
- sleep(3)
- os.reboot()
- else
- clear()
- print("Passwords Do Not Match")
- sleep(3)
- os.reboot()
- end
- end
- --Menu
- function getSelection()
- event, key = os.pullEvent("key")
- if key == 17 then
- selection = selection - 1
- if selection < 1 then
- selection = 1
- end
- drawSelected()
- elseif key == 31 then
- selection = selection + 1
- if selection > maxSelection then
- selection = maxSelection
- end
- drawSelected()
- elseif key == 28 then
- select()
- else
- getSelection()
- end
- end
- drawSelected()
Add Comment
Please, Sign In to add comment