Posted 15 May 2012 - 08:56 AM
Ok so I'm trying to creating a password code door that locks you out of the system(well it sleeps) for 30 secs after you get the code wrong 3 times.
I keep getting this error(it's different if I change around the ends but I still cant fix it)
bios:206: [string "startup"]:15: '<eof>' expected
Can someone please find the fault in my coding I've been trying for at least an hour myself(I'm very new to lua)
Here is my coding:
function pass()
shell.run("clear")
print ("Please enter password here:")
t = read("*")
if t == "password" then
print ("Password Correct!")
redstone.setOutput("left", true)
sleep(3)
redstone.setOutput("left", false)
shell.run("clear")
pass()
end
end
pass()
else
print ("Password Incorrect. Two attempts reamaining.")
sleep(2)
t = read("*")
if t == "password" then
print ("Password Correct!")
redstone.setOutput("left", true)
sleep(3)
redstone.setOutput("left", false)
shell.run("clear")
pass()
end
end
pass()
else
print ("Password Incorrect. One attempt remaining.")
sleep(2)
t = read("*")
if t == "password" then
print ("Password Correct!")
redstone.setOutput("left", true)
sleep(3)
redstone.setOutput("left", false)
shell.run("clear")
pass()
end
end
pass()
else
print ("Password Incorrect. Locking for 30 seconds.")
sleep(10)
print ("Unlocking in 20 seconds.")
sleep(10)
print ("Unlocking in 10 seconds.")
sleep(10)
print ("Console unlocked.")
sleep(2)
shell.run("clear")
pass()
end
end
pass()
I keep getting this error(it's different if I change around the ends but I still cant fix it)
bios:206: [string "startup"]:15: '<eof>' expected
Can someone please find the fault in my coding I've been trying for at least an hour myself(I'm very new to lua)
Here is my coding:
function pass()
shell.run("clear")
print ("Please enter password here:")
t = read("*")
if t == "password" then
print ("Password Correct!")
redstone.setOutput("left", true)
sleep(3)
redstone.setOutput("left", false)
shell.run("clear")
pass()
end
end
pass()
else
print ("Password Incorrect. Two attempts reamaining.")
sleep(2)
t = read("*")
if t == "password" then
print ("Password Correct!")
redstone.setOutput("left", true)
sleep(3)
redstone.setOutput("left", false)
shell.run("clear")
pass()
end
end
pass()
else
print ("Password Incorrect. One attempt remaining.")
sleep(2)
t = read("*")
if t == "password" then
print ("Password Correct!")
redstone.setOutput("left", true)
sleep(3)
redstone.setOutput("left", false)
shell.run("clear")
pass()
end
end
pass()
else
print ("Password Incorrect. Locking for 30 seconds.")
sleep(10)
print ("Unlocking in 20 seconds.")
sleep(10)
print ("Unlocking in 10 seconds.")
sleep(10)
print ("Console unlocked.")
sleep(2)
shell.run("clear")
pass()
end
end
pass()