Advertisement
Guest User

startup

a guest
Apr 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.59 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. terminatecode = "1059"
  5. passcode = "1012"
  6. sideLeft = "left"
  7. sideRight = "right"
  8. sideBack = "back"
  9. sideTop = "top"
  10. sideBottom = "bottom"
  11. opentime = 10
  12.  
  13. function load()
  14.   term.clear()
  15.   term.setTextColor(colors.green)
  16.   write("    ")
  17.   writeOut("Password Terminal - Floor 0 - Security 4/4", 0.1)
  18.   print("")
  19.   sleep(0.3)
  20.   term.setTextColor(colors.purple)
  21.   write("           ")
  22.   writeOut("-Main.Base.Computer.Network-", 0.0)
  23.   print("")
  24.   sleep(0.3)
  25.   term.setTextColor(256)
  26.   print("===================================================")
  27.   term.setTextColor(colors.blue)
  28.   term.setCursorPos(1, 17)
  29.   writeOut("Dale-OS", 0.1)
  30.   write("                             ")
  31.   term.setTextColor(colors.lightBlue)
  32.   writeOut("OS Version ", 0.1)
  33.   sleep(0.1)
  34.   writeOut("2.7", 0.1)
  35.   sleep(0.7)
  36.   term.setTextColor(colors.white)
  37.   print("")
  38.   writeOut("Loading...")
  39.   print("")
  40.   term.clear()
  41.   term.setCursorPos(0, 1)
  42.  
  43.   menu()
  44. end
  45.  
  46. function menu()
  47.   term.clear()
  48.   term.setCursorPos(0, 1)
  49.   term.setTextColor(colors.green)
  50.   print("     Password Terminal - Floor 0 - Security 4/4")
  51.   sleep(0.3)
  52.   term.setTextColor(colors.purple)
  53.   print("           -Main.Base.Computer.Network-")
  54.   sleep(0.3)
  55.   term.setTextColor(colors.blue)
  56.   write("Dale-OS                             ")
  57.   term.setTextColor(colors.lightBlue)
  58.   write("OS Version 2.7")
  59.   term.setTextColor(256)
  60.   print("===================================================")
  61.   sleep(0.7)
  62.   term.setTextColor(colors.purple)
  63.   sleep(0.5)
  64.   writeOut("Hello, ", 0.0)
  65.   sleep(0.1)
  66.   writeOut("Please enter a valid parameter:", 0.0)
  67.   print("")
  68.   prompt()
  69. end
  70.  
  71. function prompt()
  72.   term.setTextColor(colors.white)
  73.   write(">>> ")
  74.   input = string.lower(read())
  75.  
  76.   -- Passcode command --
  77.   if input == passcode then
  78.     term.setTextColor(colors.red)
  79.     print("Please make sure you are on the platform!!")
  80.     sleep(4)
  81.     term.setTextColor(colors.green)
  82.     sleep(1)
  83.     print("Elevator Active...")
  84.     rs.setOutput(sideBottom, true)
  85.     sleep(opentime)
  86.     rs.setOutput(sideBottom, false)
  87.     sleep(opentime)
  88.     os.reboot()
  89.    
  90.  
  91.   -- Info command --
  92.   elseif input == "info" then
  93.     term.setTextColor(colors.magenta)
  94.     print("Program made by Dale226")
  95.     sleep(0.3)
  96.     term.setTextColor(colors.blue)
  97.     print("This terminal is on Floor 0")
  98.     sleep(0.3)
  99.     print("This terminals securtiy ranking is, 4 of 4")
  100.     sleep(0.3)
  101.     print("This terminals modem status is: INACTIVE")
  102.  
  103.   --Termination command--
  104.   elseif input == "exit" then
  105.     write("Exit code: ")
  106.     password = read("*")
  107.    
  108.     if password == terminatecode then
  109.       error("Program Was Terminated")
  110.     else
  111.     term.setTextColor(colors.red)
  112.       print("Incorrect code")
  113.     end
  114.    
  115.     --Help command --
  116.   elseif input == "help" then
  117.     help()
  118.    
  119.   -- Invalid command --
  120.   else
  121.     term.setTextColor(colors.red)
  122.     print("Invalid Command")
  123.     term.setTextColor(colors.white)
  124.   end
  125. end
  126.  
  127. function help()
  128.     term.setTextColor(colors.blue)
  129.     print("List of available commands:")
  130.     sleep(0.5)
  131.     term.setTextColor(colors.lightBlue)
  132.     print("A valid passcode - Activates the elevator")
  133.     sleep(0.3)
  134.     print("Info - Gives info about the system")
  135.     sleep(0.3)
  136.     print("Exit - Terminates the programif proper code is given")
  137.     term.setTextColor(colors.white)
  138.     sleep(1)
  139. end
  140.  
  141. function writeOut(str, slp)
  142.   for i = 1, #str do
  143.     local c = str:sub(i,i)
  144.     write(c)
  145.     sleep(slp)
  146.   end
  147. end
  148.  
  149. load()
  150.  
  151. while true do
  152.   prompt()
  153. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement