SHOW:
|
|
- or go back to the newest paste.
| 1 | local sides = {"bottom", "back"}
| |
| 2 | - | local password = "<password>" |
| 2 | + | local password = "nineTAILED" |
| 3 | local sleepTime = 5 | |
| 4 | - | local debug = "1243" |
| 4 | + | |
| 5 | - | local oldPull = os.pullEvent |
| 5 | + | |
| 6 | - | os.pullEvent = os.pullEventRaw |
| 6 | + | |
| 7 | ||
| 8 | local function getPass() | |
| 9 | term.clear() | |
| 10 | term.setCursorPos(1,1) | |
| 11 | write("Password:")
| |
| 12 | input = read("*")
| |
| 13 | if input == password then | |
| 14 | print("Correct password!")
| |
| 15 | rs.setOutput(sides[1], true) | |
| 16 | sleep(0) | |
| 17 | rs.setOutput(sides[2], false) | |
| 18 | sleep(sleepTime) | |
| 19 | rs.setOutput(sides[1], true) | |
| 20 | sleep(0) | |
| 21 | rs.setOutput(sides[2], false) | |
| 22 | else | |
| 23 | print("You fail.")
| |
| 24 | end | |
| 25 | end | |
| 26 | ||
| 27 | local function loopGetPass() | |
| 28 | while true do | |
| 29 | getPass() | |
| 30 | end | |
| 31 | end | |
| 32 | - | if input == debug then |
| 32 | + | |
| 33 | - | break |
| 33 | + | |
| 34 | - | end |
| 34 | + | |
| 35 | os.pullEvent("redstone")
| |
| 36 | if rs.getInput(sides[2]) then | |
| 37 | sleep(1) | |
| 38 | term.clear() | |
| 39 | term.setCursorPos(1,1) | |
| 40 | print("Please wait.")
| |
| 41 | rs.setOutput(sides[1], true) | |
| 42 | sleep(0) | |
| 43 | rs.setOutput(sides[1], false) | |
| 44 | sleep(sleepTime) | |
| 45 | rs.setOutput(sides[1], true) | |
| 46 | sleep(0) | |
| 47 | rs.setOutput(sides[1], false) | |
| 48 | end | |
| 49 | end | |
| 50 | end | |
| 51 | ||
| 52 | parallel.waitForAny(loopGetPass, getInput) | |
| 53 | sleep(1) |