Advertisement
guitarplayer616

Fallout Terminal

Dec 4th, 2015
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.19 KB | None | 0 0
  1. local x,y = term.getSize()
  2. local correctPass = "amita"
  3. os.loadAPI("term")
  4. term.setTextColor(colors.lime)
  5. os.pullEvent = os.pullEventRaw
  6.  
  7. blit = function( txt, txtcol, backcol)
  8.         term.setBackgroundColor(backcol)
  9.         term.setTextColor(txtcol)
  10.         term.write(txt)
  11. end
  12.  
  13. function txt(i,o)
  14.         shell.run("clear")
  15.         textutils.slowPrint("WELCOME TO ROBCO INDUSTRIES (TM) TERMLINK",i)
  16.         print(nil)
  17.         term.write("> ")
  18.         blink(2)
  19.         textutils.slowWrite("SET TERMINAL/INQUIRE",o)
  20.         blink(1)
  21.         print(nil)
  22.         print(nil)
  23.         textutils.slowWrite("RIT-V300",o)
  24.         blink(1)
  25.         print(nil)
  26.         print(nil)
  27.         term.write("> ")
  28.         blink(2)
  29.         textutils.slowWrite("SET FILE/PROTECTION-OWNER:RWED ACCOUNTS.F",o)
  30.         blink(1)
  31.         print(nil)
  32.         term.write("> ")
  33.         blink(2)
  34.         textutils.slowWrite("SET HALT RESTART/MAINT",o)
  35.         blink(1)
  36.         print(nil)
  37.         blink(1,.2)
  38.         print(nil)
  39.     blink(2,.2)
  40.         textutils.slowWrite("Initializing Robco Industries(TM) MF Boot Agent",i)
  41.         blinkN(1,.1)
  42.         textutils.slowWrite("RETROS BIOS",i)
  43.         blinkN(1,.1)
  44.         textutils.slowWrite("RBIOS-4.02.08.00 52EE5.E7.E8",i)
  45.         blinkN(1,.1)
  46.         textutils.slowWrite("Copyright 2201-2201 Robco Ind.",i)
  47.         blinkN(1,.1)
  48.         textutils.slowWrite("Uppermem: 64 KB",i)
  49.         blinkN(1,.1)
  50.         textutils.slowWrite("Root (5AB)",i)
  51.         blinkN(1,.1)
  52.         textutils.slowWrite("Maintenance Mode",i)
  53.         blinkN(1,.1)
  54.         print(nil)
  55.         term.write("> ")
  56.         blink(3)
  57.         textutils.slowWrite("RUN DEBUG/ACCOUNTS.F",o)
  58.         blink(1)
  59.         sleep(.5)
  60. end
  61.  
  62. function password()
  63.     shell.run("clear")
  64.         textutils.slowPrint("ROBCO INDUSTRIES (TM) TERMLINK PROTOCOL",i)
  65.         textutils.slowPrint("ENTER PASSWORD NOW",i)
  66.     local c,d = term.getCursorPos()
  67.         textutils.slowWrite("4 ATTEMPT(S) LEFT: ")
  68.         boxes("slow",4)
  69.         for i=1,5 do
  70.         for i=1,3 do
  71.             term.setCursorPos(c,d+2+i)
  72.             term.clearLine()
  73.         end
  74.                 term.setCursorPos(c,d+2)
  75.         term.clearLine()
  76.                 term.write("> ")
  77.         term.setCursorBlink(false)
  78.                 local pass = read("*")
  79.         if pass:lower() ~= correctPass and i == 5 then
  80.             textutils.slowWrite(">Entry Denied",80)
  81.             blinkN(1)
  82.             textutils.slowWrite(">Lockout in progress")
  83.             blinkN(1)
  84.             scroll()
  85.             while true do
  86.                 term.setCursorPos((x/2)-(7),(y/2)-1)
  87.                 term.write("TERMINAL LOCKED")
  88.                 term.setCursorPos((x/2)-(15),(y/2)+1)  
  89.                 term.write("PLEASE CONTACT AN ADMINISTRATOR")
  90.                 sleep(1)
  91.             end
  92.                 elseif pass:lower() ~= correctPass then
  93.             textutils.slowWrite(">Entry Denied",80)
  94.             blinkN(1)
  95.             local mem = NumCorrect(pass)
  96.             textutils.slowWrite(">"..mem.." correct",80)
  97.             blinkN(1)
  98.                 else
  99.                 textutils.slowWrite(">Exact Match!",80)
  100.                         blinkN(1)
  101.                         textutils.slowPrint(">Please Wait",80)
  102.                         textutils.slowPrint(">while system",80)
  103.                         textutils.slowPrint(">is accessed",80)
  104.             blinkN(1)
  105.             scroll()
  106.             break
  107.         end
  108.         term.setCursorPos(c,d)
  109.         term.clearLine()
  110.         term.write(tostring(4-i).." ATTEMPT(S) LEFT: ")
  111.         boxes(nil,4-i)
  112.         end
  113.        
  114. end
  115.        
  116. function scroll()
  117.     local g,h = term.getCursorPos()
  118.     for i=1,h+1 do
  119.         term.scroll(1)
  120.         sleep(.1)
  121.     end
  122. end
  123.  
  124. function next()
  125.         blink(1)
  126.         print(nil)
  127. end
  128.      
  129. function NumCorrect(pass)
  130.     local count = 0
  131.     for i=1,#correctPass do
  132.         if pass:sub(i,i) == correctPass:sub(i,i) then
  133.             count = count + 1
  134.         end
  135.     end
  136.     return tostring(count).."/"..tostring(#correctPass)
  137. end
  138.  
  139. function boxes(a,f)
  140.     if a == "slow" then
  141.             for i=1,f do
  142.                     term.setBackgroundColor(colors.lime)
  143.                     textutils.slowWrite(" ")
  144.                     term.setBackgroundColor(colors.black)
  145.                     textutils.slowWrite(" ")
  146.         end
  147.         print(nil)
  148.         elseif a == nil then
  149.         for i=1,f do
  150.                     term.setBackgroundColor(colors.lime)
  151.                     term.write(" ")
  152.                     term.setBackgroundColor(colors.black)
  153.                     term.write(" ")
  154.         end
  155.     end
  156. end
  157.        
  158. function blink(p,s)
  159.         if not s then
  160.                 s = .4
  161.         end
  162.         local a,b = term.getCursorPos()
  163.         for i = 1,p do
  164.                 sleep(s)
  165.                 term.setCursorPos(a,b)
  166.                 blit(" ",colors.lime,colors.lime)
  167.                 sleep(s)
  168.                 term.setCursorPos(a,b)
  169.                 blit(" ",colors.lime,colors.black)
  170.         end
  171.         term.setCursorPos(a,b)
  172. end
  173.  
  174. function blinkN(p,s)
  175.         if not s then
  176.                 s = .4
  177.         end
  178.         local a,b = term.getCursorPos()
  179.         for i = 1,p do
  180.                 sleep(s)
  181.                 term.setCursorPos(a,b)
  182.                 blit(" ",colors.lime,colors.lime)
  183.                 sleep(s)
  184.                 term.setCursorPos(a,b)
  185.                 blit(" ",colors.lime,colors.black)
  186.         end
  187.         term.setCursorPos(1,b+1)
  188. end
  189. --local blink = coroutine.create(blink)
  190.  
  191. txt(160,30)
  192. password()
  193. shell.run("clear")
  194. shell.run("shell")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement