Advertisement
Guest User

startup

a guest
Oct 4th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.04 KB | None | 0 0
  1. --Variables
  2.   local username = ("tomte55") --Static during alpha
  3.   local password = ("sty595") --Same here
  4.   local inputU = ("")
  5.   local inputP = ("")
  6.   local os = ("DankOS")
  7.   local osV = ("1.0")
  8.  
  9. --Functions
  10.   function rawread() --Key Input
  11.     while true do
  12.       local sEvent, param = os.pullEvent("key")
  13.       if sEvent == "key" then
  14.         if param == 44 then
  15.           colorC()
  16.           print("Admin override")
  17.           colorW()
  18.           break
  19.         end
  20.       end
  21.     end
  22.   end
  23.  
  24.   function clear() --Clear fucntion
  25.     term.clear()
  26.     term.setCursorPos(1,1)
  27.   end
  28.  
  29.   function loadingS() --Loading screen
  30.     colorC()
  31.     textutils.slowPrint("<==========>", 10)
  32.     colorW()
  33.     sleep(1)    
  34.   end
  35.  
  36.   function bootS() --Boot screen
  37.     clear()
  38.     colorC()
  39.     print("|----------|")
  40.     write("|"..os)
  41.     print(" "..osV.."|")
  42.     print("|----------|")
  43.     colorW()
  44.   end
  45.  
  46.   function loginS() --Login screen
  47.     colorC()
  48.     write("Welcome:")
  49.     colorY()
  50.     print(" "..username)
  51.     colorC()
  52.     write("Password: ")
  53.     colorY()
  54.     inputP = read("*")
  55.     if inputP == password then
  56.       colorG()
  57.       print("Correct") --Correct password
  58.       colorW()
  59.       sleep(1)
  60.       clear()
  61.       bootS()
  62.     end
  63.     if inputP ~= password then --Incorrect password
  64.       colorR()
  65.       print("Incorrect!")
  66.       colorW()
  67.     end
  68.   end
  69.  
  70.   function mainS() --Main screen
  71.     boot()
  72.        
  73.   end
  74.  
  75.   function regS() --Register screen
  76.     colorC()
  77.     write("Welcome to "..os)
  78.     print(" "..osV)
  79.     colorW()
  80.   end
  81.  
  82.   function colorW() -- White color
  83.     term.setTextColor(colors.white)
  84.   end
  85.  
  86.   function colorG() --Green color
  87.     term.setTextColor(colors.green)
  88.   end
  89.  
  90.   function colorR() --Red color
  91.     term.setTextColor(colors.red)
  92.   end
  93.  
  94.   function colorC() --Cyan color
  95.     term.setTextColor(colors.cyan)
  96.   end
  97.  
  98.   function colorY() --Yellow color
  99.     term.setTextColor(colors.yellow)
  100.   end
  101.  
  102.  
  103. --Main stuff
  104. bootS()
  105. loginS()
  106. colorW()
  107. sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement