Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --The "password" triggers a redstone signal on the side "redstoneSide" to open a door, "exitProgram" is to exit the program
- --uncomment the following line if you want to disable program termination. Personally I have had problems with it so I keep it disabled.
- --os.pullEvent() = os.pullEventRaw()
- password = 'your password here'
- exitProgram = 'exitProgram'
- redstoneSide = 'bottom' --has to be one of the following: 'bottom' 'front' 'top' 'left' 'back' 'right'
- username = 'your username here'
- --Clears terminal for a new message
- function clearTerm(x)
- term.clear()
- term.setCursorPos(1,1)
- print(x)
- end
- --The main function, asks for a password and compares to the set variables.
- function enterPassword()
- clearTerm(string.format('%s\'s PC, please don\'t fiddle around!',username))
- enteredText = io.read()
- if enteredText == password then
- rs.setOutput(redstoneSide, true)
- clearTerm('Welcome')
- os.sleep(3)
- rs.setOutput(redstoneSide, false)
- enterPassword()
- elseif enteredText == exitProgram then
- clearTerm('Exitting...')
- return
- else
- clearTerm('Please stop')
- os.sleep(3)
- enterPassword()
- end
- return
- end
- enterPassword()
Add Comment
Please, Sign In to add comment