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:
term.clear()
term.setCursorPos(1,1)
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
rs.setOutput("left",false)
os.shutdown() --Shut down the computer
elseif input == debug then
exit() --Exits the program
else
print("Password Incorrect!") --If the input is incorrect! (Oh Noes!)
tries = tries + 1
if tried == 3 then
print("Incorrect Password 3 times. Emergency Procedure")
rs.setOutput("right",true)
term.clear()
term.setCursorPos(1,1)
print("Goodbye")
sleep(2)
rs.setOutput("right",false)
os.shutdown()
else
Some way of getting back to the start of the code
end
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...
Thanks!
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?
copy:13: Access denied
help would be appreciated!
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:
I think that should work
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...
Thanks!
My previous/current work: Plantology
I'd try this:
| ----
O C
| ----
O - Player
C - Computer
| - Wall
- - redstone
deletedbut i get this error that says```startup:2: attempt to call nil
can you please help?
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?