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.setCursorPos( 1, 5 )
- mon.write( "Please Enter" )
- user = "user"
- return true
- elseif input == debug then
- print( "Hi Dave. You're looking good today" )
- mon.clear()
- mon.setCursorPos( 1, 5 )
- mon.write( "Hi Dave." )
- mon.setCursorPos( 1, 6 )
- mon.write( " You're looking" )
- mon.setCursorPos( 1, 7 )
- mon.write( " good today." )
- user = "poweruser"
- return true
- end
- return false
- end
- function opendoor( user )
- rs.setOutput( "top", false )
- sleep( 0.5 )
- rs.setOutput( "bottom", true )
- end
- function closedoor()
- rs.setOutput( "bottom", false )
- sleep( 0.5 )
- rs.setOutput( "top", true )
- end
- -- program --------------------------------------------------
- -- make sure door is shut
- closedoor()
- -- clear the screen
- term.clear()
- -- setup monitor
- mon = peripheral.wrap( "left" )
- mon.clear()
- mon.setCursorPos( 1, 5 )
- if enterPassword( mon ) then
- opendoor( user )
- else
- mon.clear()
- mon.setCursorPos( 1, 5 )
- mon.write( "Leave this place" )
- mon.setCursorPos( 1, 6 )
- mon.write( "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