Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Password startup
- os.pullEvent = os.pullEventRaw
- local pass = "password" --Desired password
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("Loading secure startup")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Loading secure startup.")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Loading secure startup..")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Loading secure startup...")
- sleep(.2)
- print("No errors detected.")
- sleep(.3)
- print("Starting password protocols")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Loading secure startup...")
- print("No errors detected.")
- print("Starting password protocols.")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Loading secure startup...")
- print("No errors detected.")
- print("Starting password protocols..")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Loading secure startup...")
- print("No errors detected.")
- print("Starting password protocols...")
- sleep(.3)
- term.clear()
- term.setCursorPos(1,1)
- sleep(.4)
- print("Password required.")
- print("Please type in the password.")
- local input = read("*")
- if input == pass then
- term.clear()
- term.setCursorPos(1,1)
- sleep(.1)
- print("Password accepted.")
- sleep(.6)
- print("Loading NhUI v0.1a - 0%")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Password accepted.")
- print("Loading NhUI v0.1a - 36%")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Password accepted.")
- print("Loading NhUI v0.1a - 74%")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Password accepted.")
- print("Loading NhUI v0.1a - 100%")
- sleep(.3)
- print("Loading complete.")
- sleep(.2)
- print("Initializing")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Password accepted.")
- print("Loading NhUI v0.1a - 100%")
- print("Loading complete.")
- print("Initializing.")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Password accepted.")
- print("Loading NhUI v0.1a - 100%")
- print("Loading complete.")
- print("Initializing..")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Password accepted.")
- print("Loading NhUI v0.1a - 100%")
- print("Loading complete.")
- print("Initializing...")
- sleep(.4)
- term.clear()
- term.setCursorPos(1,1)
- sleep(.6)
- break
- else
- print("Access denied.")
- sleep(.6)
- term.clear()
- term.setCursorPos(1,1)
- print("Clearing cache")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Clearing cache.")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Clearing cache..")
- sleep(.2)
- term.clear()
- term.setCursorPos(1,1)
- print("Clearing cache...")
- sleep(.3)
- print("Cache cleared.")
- sleep(.2)
- print("Resetting parameters")
- sleep(.3)
- term.clear()
- term.setCursorPos(1,1)
- print("Clearing cache...")
- print("Cache cleared.")
- print("Resetting parameters.")
- sleep(.3)
- term.clear()
- term.setCursorPos(1,1)
- print("Clearing cache...")
- print("Cache cleared.")
- print("Resetting parameters..")
- sleep(.3)
- term.clear()
- term.setCursorPos(1,1)
- print("Clearing cache...")
- print("Cache cleared.")
- print("Resetting parameters...")
- sleep(.4)
- term.clear()
- term.setCursorPos(1,1)
- sleep(.6)
- end
- end
- --Functions
- slc = 0
- tBarC = 32768
- tBartC = 1
- backColor = 32768
- term.setBackgroundColor(backColor)
- term.clear()
- function titleBar()
- term.setCursorPos(1,1)
- term.setBackgroundColor(tBarC)
- term.setTextColor(tBartC)
- term.clearLine()
- term.setCursorPos(2, 1)
- print("//Start//")
- end
- function drawDesktop()
- term.setBackgroundColor(backColor)
- term.clear()
- term.setCursorPos(47,17)
- term.setTextColor(128)
- print("NhUI")
- term.setCursorPos(2,18)
- term.setTextColor(256)
- print("(Click the menus for more options.)")
- term.setCursorPos(46,18)
- term.setTextColor(128)
- print("v0.1a")
- titleBar()
- end
- function drawMenu1()
- term.setTextColor(1)
- term.setBackgroundColor(32768)
- term.setCursorPos(2,2)
- print(">Shutdown")
- term.setCursorPos(2,3)
- print(">Restart")
- term.setCursorPos(2,4)
- print(">CraftOS")
- end
- --Desktop
- drawDesktop()
- while true do
- local event, button, x, y = os.pullEventRaw()
- if slc == 0 then
- if event == "mouse_click" then
- if x>=2 and x<=12 and y==1 and button==1 then
- drawMenu1()
- slc = 1
- else
- drawDesktop()
- end
- end
- elseif slc == 1 then
- if x>=1 and x<=12 and button==1 and y==2 then slc = 0
- os.shutdown()
- elseif x>=1 and x<=12 and y==3 and button==1 then slc = 0
- os.reboot()
- elseif x>=1 and x<=12 and y==4 and button==1 then slc = 0
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(16)
- print("CraftOS 1.5 (Ctrl+R will reinitialize NhUI.)")
- term.setTextColor(1)
- break
- else
- slc = 0
- drawDesktop()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement