could you help me with the code for if the password is incorrect 3 (or more) times, a differnet signle get set off.
Try making another variable for example called tries and make tries = 0 and every time you get the password wrong, it does tries = tries + 1 then if tries == 3 and do the different signal
so something like this:
password = "cheese" --Sets the password
debug = "applesareyummm" --Sets debugging password
tries = 0
write("Enter your password: ")
input = read() --Input the password
term.clear() --Clearing the terminal, and...
term.setCursorPos(1,1) --...THEN setting the cursor position
if input == password then
print("Password Correct!") --If the input is correct!
rs.setOutput("left",true) --Change this and the setOutput to the side the door is on
sleep(2) --Pause for 2 seconds
os.shutdown() --Shut down the computer
elseif input == debug then
exit() --Exits the program
print("Password Incorrect!") --If the input is incorrect! (Oh Noes!)
tries = tries + 1
if tried == 3 then
print("Incorrect Password 3 times. Emergency Procedure")
Some way of getting back to the start of the code
end --Ends the 'if' block
I was looking through the locked door one and noticed that you can dictate which side the output send the signal...
I am looking for a lock for my servers chests that I am setting up and was hoping I could have one password for that and than a secret password only I know about (I always like being sneaky :D) that can output a signal to a different mechanism (say...a secret staircase). I assume (and will try as soon as I get home) that I can and just have one input left and one right or whatever but I thought I would just ask...
Rollback Post to RevisionRollBack
A modded looking for dedicated (at least consistent) texture artists/modelers to make magic with! Not literally magic...but...mods! PM me...
Yes, actually the exit() is a typo. Yes, it technically exits the script which we want, but not quite the right way.
Right now I can't recall the right command, but there's often a way to just break all loops and just exit. I'll get back on that command.
The BIOS error could be an installation problem. Other than that, I don't know; sorry!
I think you are either thinking of 'return' or 'break'. I think it's 'return' though.
Also, this is a bit off topic, but would you mind making a tutorial on passing args?