Advertisement
Guest User

startup

a guest
Jul 4th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.94 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. local function pause(key)
  3.   print('Press X to continue.')
  4.   while true do
  5.             local sEvent, sParam=os.pullEvent('char')
  6.             if string.lower(sParam)==key then
  7.    break
  8.             end
  9.   end
  10. end
  11. local progressbar = {"----------","o---------","oo--------","ooo-------","oooo------","ooooo-----","oooooo----","ooooooo---","oooooooo--","ooooooooo-","oooooooooo"} -- added the possible strings into a table
  12. term.clear()
  13. sleep(0.3)
  14. term.setCursorPos(15,2)
  15. print("RandomZOS is starting...")
  16. for i=1,#progressbar do
  17. term.setCursorPos(20,4)
  18. print(progressbar[i])
  19. sleep(0.5)
  20. end
  21. sleep(1.0)
  22. term.clear()
  23. term.setCursorPos(21,2)
  24. print("Welcome!")
  25. sleep(2.5)
  26. local intcount=0
  27. term.clear()
  28. term.setCursorPos(1,1)
  29. print("Login")
  30. while true do
  31.   write("Username: ")
  32.   userNameInput = read()
  33.   if string.lower(userNameInput) == "admin" then
  34.    sleep(1)
  35.    break
  36.   else
  37.   sleep(1)
  38.    print("Username not found.")
  39.    intcount=intcount+1
  40.    sleep(1)
  41.    for i=3,2,-1 do
  42.             term.setCursorPos(1,i)
  43.             term.clearLine()
  44.    end
  45.   end
  46.   if intcount==3 then
  47.    print('You have entered an invalid username too many times.')
  48.    sleep(5)
  49.    os.shutdown()
  50.   end
  51. end
  52. local intcount=0
  53. while true do
  54.   write("Password: ")
  55.   passwordInput = read("*")
  56.   print("Verifying login...")
  57.   sleep(2.5)
  58.   if passwordInput == "admin" then
  59.   print("Loading your settings...")
  60.   sleep(1.5)
  61.   print("Logging in...")
  62.   sleep(3.5)
  63.   term.clear()
  64.   term.setCursorPos(1,1)
  65.    print("Welcome to RandomZOS!")
  66.    pause('x')
  67.    term.setCursorPos(1,2)
  68.    term.clearLine()
  69.    break
  70.   else
  71.    print("The password you have entered is incorrect.")
  72.    intcount=intcount+1
  73.    sleep(1)
  74.    for i=6,3,-1 do
  75.             term.setCursorPos(1,i)
  76.             term.clearLine()
  77.    end
  78.   end
  79.   if intcount==3 then
  80.    print('You have entered an incorrect password too many times.')
  81.    sleep(5)
  82.    os.shutdown()
  83.   end
  84. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement