19 posts
Posted 30 September 2012 - 02:44 PM
Pretty simple. But it won't work, like usual.
print ("Password Lock, By Noah
sleep(3)
print ("Please out your door on the left side of this device")
sleep(5)
print ("Please eneter your password")
if name = "Alienware" then
redstone.setOutput ("left", true)
print ("Welcome!")
sleep(5)
redstone.setOutput ("left", false)
os.reboot()
end
if else
print ("Password Incorrect!")
os.reboot()
end
This is what I get
bios:206: [string "PasswordLockByNoah"]:6: 'then'
expected
107 posts
Posted 30 September 2012 - 02:47 PM
Try this:
print ("Password Lock, By Noah")
sleep(3)
print ("Please out your door on the left side of this device")
sleep(5)
print ("Please eneter your password")
name = io.read()
if name == "Alienware" then
redstone.setOutput ("left", true)
print ("Welcome!")
sleep(5)
redstone.setOutput ("left", false)
os.reboot()
elseif
print ("Password Incorrect!")
os.reboot()
end
Your forgot to set the variable "name" and it has to be name ==. Also the print at the beginning wasn't closed. If else is also wrong, it's elseif.
19 posts
Posted 30 September 2012 - 02:51 PM
Now I'm getting an error about an unexpected symbol.
107 posts
Posted 30 September 2012 - 02:52 PM
Please post the errorcode.
19 posts
Posted 30 September 2012 - 02:54 PM
Ok, here it is
bios:206: [string "PasswordLockByNoah"]:14:
unexpected symbol
107 posts
Posted 30 September 2012 - 02:59 PM
oh ofcourse! use "else" only instead of elseif.
521 posts
Location
Stockholm, Sweden
Posted 30 September 2012 - 02:59 PM
Well you got
elseif
without any parameters at line 13…
19 posts
Posted 30 September 2012 - 03:02 PM
I fixed that one, now there's a new one…..
bios:206: [string "PasswordLockByNoah"] :14:
'<eof>' expected
521 posts
Location
Stockholm, Sweden
Posted 30 September 2012 - 03:06 PM
Spoiler
I fixed that one, now there's a new one…..
bios:206: [string "PasswordLockByNoah"] :14:
'<eof>' expected
What did you do? Can you show us the "new" code?
19 posts
Posted 30 September 2012 - 03:10 PM
I'm just doing what you guys are telling me to do :3
107 posts
Posted 30 September 2012 - 03:12 PM
os.reboot()
else
print ("Password Incorrect!")
os.reboot()
end
That's how the code should look at the end, does it look like this?
19 posts
Posted 30 September 2012 - 03:12 PM
Yep!
107 posts
Posted 30 September 2012 - 03:14 PM
Post your whole code again, how does it look right now? I cant find any errors.
521 posts
Location
Stockholm, Sweden
Posted 30 September 2012 - 03:17 PM
Spoiler
I'm just doing what you guys are telling me to do :3
Well just add a post with the new code, and we'll take a new look at it.
55 posts
Location
Everywhere.
Posted 30 September 2012 - 03:59 PM
Is there a space bettween print and the ("words")? In your orriginal code there is. You cant do that(last time I cheaked). remove the space.
521 posts
Location
Stockholm, Sweden
Posted 30 September 2012 - 04:01 PM
Spoiler
Is there a space bettween print and the ("words")? In your orriginal code there is. You cant do that(last time I cheaked). remove the space.
I actually think you can have spaces, I don't even think that is the problem…
EDIT: I just tried it, and it workes (the spaces between print and the arguments).
521 posts
Location
Stockholm, Sweden
Posted 30 September 2012 - 04:14 PM
So I just tried your script and it worked!
So you must have messed something up, or (if you are playing on a server) the server is a bit buggy…
Images:
Spoiler
I added it to pastebin, so if someone else want to try then here you go:
5ncnJF0r
19 posts
Posted 30 September 2012 - 07:59 PM
I'm running CraftOS 1.3, is that the problem?
I KNOW! I didn't put double enter, so I need to press enter another time.
521 posts
Location
Stockholm, Sweden
Posted 30 September 2012 - 07:59 PM
I'm running CraftOS 1.3, is that the problem?
It
might be… I don't know what they added coding wise when they updated to CC 1.4
19 posts
Posted 30 September 2012 - 08:02 PM
Thanks! You really helped me!
it works!
521 posts
Location
Stockholm, Sweden
Posted 30 September 2012 - 08:02 PM
Thanks! You really helped me!
it works!
Well I'm glad that I could help you :)/>/>