Keypad script problem
thegamerguy3
01 May 2020, 16:47I can't figure out why the script doesn't work. I used the script from this website: http://docs.textadventures.co.uk/quest/guides/unlockdoor.html
I did the same thing as the second picture has, and I get this error: "Error running script: Error compiling expression 'result=1594': Unknown object or variable 'result'"
Image of my problem: https://imgur.com/a/Fz2LP8k
Be nice, I'm new :)
mrangel
01 May 2020, 17:20If it's saying result is unknown, you likely missed out the "get input" step.
Also, looking at that error message makes me think that you have some quotes missing. A result entered by the player will always be a string, and you can't compare strings to numbers. So your expression will need to be result="1594"
, not result=1594
.
thegamerguy3
01 May 2020, 22:59Thanks! Both things are missing, so I will add those right away.
thegamerguy3
05 May 2020, 15:35I get this error now. What is wrong now?
use keypad
Please enter password:
1594
I don't understand your command.
Code:
msg ("Please enter password:")
get input {
if ( result="1594") {
UnlockExit (safe room)
}
else {
msg ("Incorrect code. Please try again.")
}
}