Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- GLOBALS
- os.pullEvent = os.pullEventRaw -- prevents ctrl+t
- user = ""
- password = "beetlejuice"
- debug = "redux"
- -- function definitions -------------------------------------
- function enterPassword( mon )
- mon.write( "Enter password: " )
- print( "Please enter password: " )
- input = read( "*" )
- if input == password then
- print( "Please Enter" )
- mon.clear()
- mon.write( "Please Enter" )
- user = "user"
- return true
- elseif input == debug then
- print( "Hi Dave. You're looking good today" )
- mon.clear()
- mon.write( "HI Dave. You're looking good today" )
- user = "poweruser"
- return true
- end
- return false
- end
- function opendoor( user )
- rs.setOutput( "top", false )
- sleep( 1 )
- rs.setOutput( "bottom", true )
- end
- function closedoor()
- rs.setOutput( "bottom", false )
- sleep( 1 )
- rs.setOutput( "top", true )
- end
- -- program --------------------------------------------------
- -- make sure door is shut
- closedoor()
- -- clear the screen
- term.clear()
- -- setup monitor
- mon = peripheral.wrap( "left" )
- if enterPassword( mon ) then
- opendoor( user )
- else
- mon.clear()
- mon.write( "Leave this place and never return" )
- print( "Leave this place and never return" )
- end
- if user ~= "poweruser" then
- sleep( 5 )
- closedoor()
- os.reboot()
- end
Add Comment
Please, Sign In to add comment