Guest User

Untitled

a guest
Oct 5th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. -- GLOBALS
  2. os.pullEvent = os.pullEventRaw -- prevents ctrl+t
  3. user = ""
  4. password = "beetlejuice"
  5. debug = "redux"
  6.  
  7. -- function definitions -------------------------------------
  8. function enterPassword( mon )
  9.     mon.write( "Enter password: " )
  10.     print( "Please enter password: " )
  11.  input = read( "*" )
  12.     if input == password then
  13.         print( "Please Enter" )
  14.   mon.clear()
  15.   mon.write( "Please Enter" )
  16.   user = "user"
  17.         return true
  18.     elseif input == debug then
  19.   print( "Hi Dave. You're looking good today" )
  20.   mon.clear()
  21.   mon.write( "HI Dave. You're looking good today" )
  22.         user = "poweruser"
  23.         return true
  24.     end
  25. return false
  26. end
  27.  
  28. function opendoor( user )
  29.     rs.setOutput( "top", false )
  30.     sleep( 1 )
  31.     rs.setOutput( "bottom", true )
  32. end
  33.  
  34. function closedoor()
  35.     rs.setOutput( "bottom", false )
  36.     sleep( 1 )
  37.     rs.setOutput( "top", true )
  38. end
  39.  
  40. -- program --------------------------------------------------
  41.  
  42. -- make sure door is shut
  43. closedoor()
  44.  
  45. -- clear the screen
  46. term.clear()
  47. -- setup monitor
  48. mon = peripheral.wrap( "left" )
  49.  
  50. if enterPassword( mon ) then
  51.     opendoor( user )
  52. else
  53.  mon.clear()
  54.  mon.write( "Leave this place and never return" )
  55.  print( "Leave this place and never return" )
  56. end
  57.  
  58. if user ~= "poweruser" then
  59.  sleep( 5 )
  60.  closedoor()
  61.     os.reboot()
  62. end
Add Comment
Please, Sign In to add comment