Jump to content




Door lock with password not working?


  • You cannot reply to this topic
1 reply to this topic

#1 LuffyNL

  • Members
  • 16 posts

Posted 07 July 2012 - 11:54 AM

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:
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.

#2 LuffyNL

  • Members
  • 16 posts

Posted 07 July 2012 - 11:57 AM

Nevermind i got it working now :P/>
I had to put "bottom" and "back"
instead of bottom and back
Derp :3





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users