batubozkan

Hideout

Nov 24th, 2020 (edited)
588
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local side = "back"
  2. local password = "batcave"
  3. local opentime = 4
  4.  
  5. local function signalOff(side)
  6.   rs.setOutput(side, true)
  7.   sleep(0.1)
  8. end
  9.  
  10. local function signalOn(side)
  11.   rs.setOutput(side, false)
  12.   sleep(0.1)
  13. end
  14.  
  15. function gate()
  16.   while true do
  17.   term.clear()
  18.   term.setCursorPos(1,1)
  19.   write("Password: ")
  20.   local input = read("*")
  21.   if input == password then
  22.       term.clear()
  23.       term.setCursorPos(1,1)
  24.       print("Password Accepted! Reactor doors are open!")
  25.       signalOn("back")
  26.       local event, key = os.pullEvent( "key" )
  27.       if key == keys.enter then
  28.         print( "Reactor doors are closing! Goodbye!" )
  29.         sleep(2)
  30.         signalOff("back")
  31.       end
  32.     else
  33.       print("Password incorrect!")
  34.       sleep(2)
  35.     end
  36.   end
  37. end
  38.  
  39. gate()
RAW Paste Data