Advertisement
DeanReid

Password Frame Door

Oct 6th, 2013 (edited)
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.88 KB | None | 0 0
  1. password = "bitchbetrippin"
  2. guesses = 0
  3. greeting = "%DESCRIPTION%"
  4. lockTime = 10
  5. timeLeft = lockTime
  6.  
  7. GUESS_LIMIT = 3
  8.  
  9. --
  10. --This will tell the user if the guesses left, and if the password is wrong
  11. --
  12.  
  13. while guesses < GUESS_LIMIT do
  14.     term.clear()
  15.     term.setCursorPos(1,1)
  16.     write(greeting.."\n\n")
  17.     write(GUESS_LIMIT - guesses.." attempts remaining\n\n")
  18.         write("Incorrect Password. Please try again!\n\n\n")
  19.  
  20. --
  21. --This will ask the user to enter a password from the above variable
  22. --
  23.     write("Please enter password: ")
  24.  
  25.     guess = read("*")
  26.  
  27. --
  28. --If the password is correct it will turn the bottom output of the monitor to on, then off incrementally until the
  29. --door is open, defined by the amount of spaces it this should be changed it will then close the door with the same --amount of spaces
  30. --
  31.     if guess == password then
  32.  
  33.         redstone.setBundledOutput("bottom", colors.orange)
  34.         sleep(1)
  35.         redstone.setBundledOutput("bottom", 0)
  36.         sleep(1)
  37.         redstone.setBundledOutput("bottom", colors.orange)
  38.         sleep(1)
  39.         redstone.setBundledOutput("bottom", 0)
  40.         sleep(1)
  41.         redstone.setBundledOutput("bottom", colors.orange)
  42.         sleep(1)
  43.         redstone.setBundledOutput("bottom", 0)
  44.         sleep(1)
  45.         redstone.setBundledOutput("bottom", colors.orange)
  46.         sleep(1)
  47.         redstone.setBundledOutput("bottom", 0)
  48.         sleep(1)
  49.         redstone.setBundledOutput("bottom", colors.orange)
  50.         sleep(1)
  51.         redstone.setBundledOutput("bottom", 0)
  52.         sleep(1)
  53.         redstone.setBundledOutput("bottom", colors.orange)
  54.         sleep(1)
  55.         redstone.setBundledOutput("bottom", 0)
  56.         sleep(1)
  57.         redstone.setBundledOutput("bottom", colors.orange)
  58.         sleep(1)
  59.         redstone.setBundledOutput("bottom", 0)
  60.         sleep(1)
  61.         redstone.setBundledOutput("bottom", colors.orange)
  62.         sleep(1)
  63.         redstone.setBundledOutput("bottom", 0)
  64.         sleep(1)
  65.         redstone.setBundledOutput("bottom", colors.orange)
  66.         sleep(1)
  67.         redstone.setBundledOutput("bottom", 0)
  68.         sleep(1)
  69.         redstone.setBundledOutput("bottom", colors.orange)
  70.         sleep(1)
  71.         redstone.setBundledOutput("bottom", 0)
  72.         sleep(10)
  73.         redstone.setBundledOutput("bottom", colors.white)
  74.         sleep(1)
  75.         redstone.setBundledOutput("bottom", 0)
  76.         sleep(1)
  77.         redstone.setBundledOutput("bottom", colors.white)
  78.         sleep(1)
  79.         redstone.setBundledOutput("bottom", 0)
  80.         sleep(1)
  81.         redstone.setBundledOutput("bottom", colors.white)
  82.         sleep(1)
  83.         redstone.setBundledOutput("bottom", 0)
  84.         sleep(1)
  85.         redstone.setBundledOutput("bottom", colors.white)
  86.         sleep(1)
  87.         redstone.setBundledOutput("bottom", 0)
  88.         sleep(1)
  89.         redstone.setBundledOutput("bottom", colors.white)
  90.         sleep(1)
  91.         redstone.setBundledOutput("bottom", 0)
  92.         sleep(1)
  93.         redstone.setBundledOutput("bottom", colors.white)
  94.         sleep(1)
  95.         redstone.setBundledOutput("bottom", 0)
  96.         sleep(1)
  97.         redstone.setBundledOutput("bottom", colors.white)
  98.         sleep(1)
  99.         redstone.setBundledOutput("bottom", 0)
  100.         sleep(1)
  101.         redstone.setBundledOutput("bottom", colors.white)
  102.         sleep(1)
  103.         redstone.setBundledOutput("bottom", 0)
  104.         sleep(1)
  105.         redstone.setBundledOutput("bottom", colors.white)
  106.         sleep(1)
  107.         redstone.setBundledOutput("bottom", 0)
  108.         sleep(1)
  109.         redstone.setBundledOutput("bottom", colors.white)
  110.         sleep(1)
  111.         redstone.setBundledOutput("bottom", 0)
  112.         sleep(4)
  113.        
  114.     os.reboot()
  115.        
  116. --
  117. --If the password is incorrect it will lock the screen for the amount of time set above and then reboot
  118. --
  119.     else
  120.  
  121.         guesses = guesses + 1
  122.         term.clear()
  123.         term.setCursorPos(1,1)
  124.         write("Password Incorrect")
  125.     end
  126. end
  127.  
  128. while timeLeft > 0 do
  129.     term.clear()
  130.     term.setCursorPos(1,1)
  131.     write("Number of permitted guesses exceeded.\n\nLocking Terminal for "..timeLeft.." seconds.")
  132.     timeLeft = timeLeft - 1
  133.     sleep(1)
  134.     os.reboot()
  135. end
  136. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement