Posted 07 July 2012 - 12:54 PM
Ok, so i have a Computer with a password.
If it is correct the door will open for 5 seconds (Bottom output)
if it is incorrect a alarm will go off for 15 seconds (Back Output)
I typed:
edit startup
Then i wrote this:
Everything seems to be working fine untill you insert a password.
If it is Correct it shows this:
Password correct! Opening door…
startup:11: bad argument: string expected, got nil
If it is Incorrect it shows this:
Password Incorrect! Activating alarm…
startup:19: bad argument: string expected, got nil
Please help me.
If it is correct the door will open for 5 seconds (Bottom output)
if it is incorrect a alarm will go off for 15 seconds (Back Output)
I typed:
edit startup
Then i wrote this:
local password = "Test"
local opentime = 5
term.clear()
term.setCursorPos(1,1)
write("Password: ")
local input = read(*)
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Password Correct! Opening door...")
redstone.setOutput(bottom,true)
sleep(opentime)
redstone.setOutput(bottom,false)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
print("Password Incorrect! Activating alarm...")
redstone.setOutput(back,true)
sleep(15)
redstone.setOutput(back,false)
os.reboot()
end
Everything seems to be working fine untill you insert a password.
If it is Correct it shows this:
Password correct! Opening door…
startup:11: bad argument: string expected, got nil
If it is Incorrect it shows this:
Password Incorrect! Activating alarm…
startup:19: bad argument: string expected, got nil
Please help me.