SHOW:
|
|
- or go back to the newest paste.
1 | os.pullEvent = os.pullEventRaw | |
2 | local side = "left" -- Change left to whatever side your door / redstone is on, E.G: left, right, front, back, bottom, top. Be sure to leave the "s around it, though | |
3 | local password = "arf" -- Change bacon to what you want your password to be. Be sure to leave the "s around it, though | |
4 | local opentime = 5 -- Change 5 to how long (in seconds) you want the redstone current to be on. Don't put "s around it, though | |
5 | while true do | |
6 | term.clear() -- Clears the screen | |
7 | term.setCursorPos(1,1) -- Fixes the cursor position | |
8 | write("Password: ") -- Prints 'Password: ' to the screen | |
9 | local input = read("*") -- Makes the variable 'input' have the contents of what the user types in, the "*" part censors out the password | |
10 | if input == password then -- Checks if the user inputted the correct password | |
11 | term.clear() -- Already explained up top | |
12 | term.setCursorPos(1,1) | |
13 | print("Password correct!") -- Prints 'Password correct!' to the screen | |
14 | - | rs.setOutput(side,true) -- Output a redstone current to the side you specified |
14 | + | rs.setOutput(back,true) -- Output a redstone current to the side you specified |
15 | sleep(opentime) -- Wait the amount of seconds you specifed, then.. | |
16 | - | rs.setOutput(side,false) -- Stop outputting a redstone current |
16 | + | rs.setOutput(back,false) -- Stop outputting a redstone current |
17 | else -- Checks if the user didn't input the correct password | |
18 | print("Password incorrect!") -- Prints 'Password incorrect!' to the screen | |
19 | sleep(2) -- Waits 2 seconds | |
20 | end | |
21 | end |