Posted 16 July 2012 - 08:34 AM
I try to make a door lock, which has two Redpower lamps (red and green), that switch when the password is correct. So when the password is correct, the red lamp turns off, and the green, in combination with the door, turns on. after four seconds, they switch again so that red's turned on. Also, redhas to bun always when the door is closed, so even if the computer's turned off.
Now i wrote a program to do this, but it gives th following error:
This is the code (not completed yet, but i tested it before i added the lamp switch and it worked):
I really dont understand why this error came, so i hope someone here would be able to help me.
Also, I'm not very good with Lua yet, because I only use it about 4 days, Although i have programmed earlier in BASIC(QB), and I understand Lua
Now i wrote a program to do this, but it gives th following error:
bios:206: [string "lock"]:30: ')' expected to (close '(' at line 29)
I understand that there must be a peranthesis at line 30, but there is one.This is the code (not completed yet, but i tested it before i added the lamp switch and it worked):
os.pullEvent = os.pullEventRaw
function clear()
term.clear()
term.setCursorPos(1,1)
end
triesLeft = 5
function tries()
triesLeft = triesLeft - 1
triesLeftText = tostring(triesLeft)
end
tries()
term.redirect(peripheral.wrap("right"))
clear()
print("Enter password to open")
term.restore()
clear()
write("Enter your password: ")
password = read("*")
if password == "MyPassword" then
print("Password correct!")
rs.setBundledOutput("back", colors.orange)
rs.setBundledOutput("back"
rs.getBundledOutput("back") - colors.white)
sleep(4)
rs.setBundledOutput("back", colors.white)
rs.setBundledOutput("back"
rs.getBundledOutput("back") - colors.orange)
else
print("Password incorrect, try again")
end
I really dont understand why this error came, so i hope someone here would be able to help me.
Also, I'm not very good with Lua yet, because I only use it about 4 days, Although i have programmed earlier in BASIC(QB), and I understand Lua