Posted 30 March 2013 - 08:54 AM
Hello again, I had an earlier post where I asked about loops and got a good response, but I am still unable to fully figure out what is wrong with my code.
The code is for a password door that gives 3 guesses before it gives a redstone output.
If you could help me out by showing me what to fix that would be great, thanks!
The code is for a password door that gives 3 guesses before it gives a redstone output.
os.pullEvent = os.pullEventRaw
local password = "password123"
local guess = 0
repeat
term.clear()
term.setCursorPos(1,1)
write("Password: ")
local input = read("*")
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Correct!")
rs.setOutput("right",true)
sleep(5)
rs.setOutput("right",false)
else
print("Try again...")
guess = guess + 1
until guess == 3
print("Good bye!")
rs.setOutput("back",true)
sleep(5)
rs.setOutput("back",false)
end
If you could help me out by showing me what to fix that would be great, thanks!