Jump to content




[error] password script trouble ->[string "startup"]:10: ')' expected


2 replies to this topic

#1 115billy

  • New Members
  • 2 posts

Posted 27 July 2012 - 09:25 PM

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 :)/>

#2 sjele

  • Members
  • 334 posts
  • LocationSomewhere on the planet called earth

Posted 27 July 2012 - 09:57 PM

This should work.
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 115billy

  • New Members
  • 2 posts

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