So i'm trying to create a door password script (see below)
function lock()
term.clear()
term.setCursorPos(1,1)
os.PullEvent = os.pullEventRaw
pass = oi.read()
if pass == "test" then
term.clear()
redstone.setOutput("right", true)
sleep(3)
redstone.setOutput("right", false)
lock()
else
lock()
end
end
lock()
it is saved to disk/startup
I get an error saying that in line 10, there's a ')' missing when first putting in the floppy then activating the computer, but based on this video it looks fine to me.
I'm very new to this, so if there's an obvious problem, lemme now. Thanks />
0
[error] password script trouble ->[string "startup"]:10: ')' expected
Started by 115billy, Jul 27 2012 09:25 PM
2 replies to this topic
#1
Posted 27 July 2012 - 09:25 PM
#2
Posted 27 July 2012 - 09:57 PM
This should work.
This is my pw lock, put this on the right side of the door you want to open
function lock() term.clear() term.setCursorPos(1,1) os.PullEvent = os.pullEventRaw pass = io.read() --Edit happned here, it is supposed to be io.read() not oi.read() if pass == "test" then term.clear() redstone.setOutput("right", true) sleep(3) redstone.setOutput("right", false) lock() else lock() end end lock()
This is my pw lock, put this on the right side of the door you want to open
os.pullEvent = os.pullEventRaw pass = "password" --Change you're pw here print("Password lock!") write "Password: " input = read() if input == pass then print("Accsess granted!") rs.setOutput ("right",true) sleep(5) os.shutdown() else print ("Wrong password!") sleep(3) os.shutdown() end
#3
Posted 27 July 2012 - 11:35 PM
Thanks! Dumb mistake as I thought!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users