Advertisement
Guest User

startup

a guest
Jun 13th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. --Disable the terminating of programs
  2. os.pullEvent = os.pullEventRaw
  3. --------------------------------------
  4. loginValue = false
  5. value = 0
  6. goToRoot = false
  7. --Startup Function-
  8. function startup()
  9.   term.clear()
  10.   term.setCursorPos(1,1)
  11.   print("Booting System...")
  12.   while value < 17 do
  13.     value = value + 1
  14.     paintutils.drawPixel(value,2, colors.red)
  15.     sleep(0)
  16.   end
  17.   paintutils.drawLine(1,2,17,2, colors.green)
  18.   term.setCursorPos(5,2)
  19.   print("Complete")
  20.   paintutils.drawPixel(0,0,colors.black)
  21.   term.setCursorPos(1,4)
  22. end
  23. --Login Fucntion--
  24. function login()
  25.   loggedInAs = null
  26.   if loginValue == false then
  27.     print("Username:")
  28.     local username = read()
  29.     print("Password:")
  30.     local password = read("*")
  31.     if username == "Dark" and password == "Dark" then
  32.       print("Logged in as ", username)
  33.       loggedInAs = username
  34.       loginValue = true
  35.     else
  36.       print("Invalid password.")
  37.       sleep(2)
  38.       startup()
  39.     end
  40.   else
  41.     print("logging in as: " , username)
  42.   end
  43. end
  44. ----------------------
  45. -- end of functions --
  46. ----------------------
  47. startup()
  48. print("Available actions: terminal, login, logout, root")
  49. while goToRoot == false do
  50.   input = read()
  51.   if input == "terminal" then
  52.     print("Enabeling AE Terminal")
  53.     login()
  54.   end
  55.   if input == "login" then
  56.     login()
  57.   end
  58.   if input == "logout" then
  59.     loginValue = false
  60.     print("Successfully logged out.")
  61.   end
  62.   if input == "root" then
  63.     if loginValue == false then
  64.       print("Root access requires you to be logged in.")
  65.       login()
  66.     end
  67.     if loginValue == true then
  68.        goToRoot = true
  69.     end
  70.   end
  71. end
  72. startup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement