"If" Expressions for a keypad
Pugubuz
25 Mar 2015, 22:23I wanted to make a door open only when you type the correct code into the keypad. I found this guide (http://docs.textadventures.co.uk/quest/ ... kdoor.html) that does just that but whenever I type it on using my code (357289) it gives me this error message
> use keypad
Please insert the security code:
Error running script: Error compiling expression 'result="357289"': Unknown object or variable 'result'
I've tried it with other codes to and it never works. I think the problem is it's not recognizing "result" as a command but I don't know what to do instead.
> use keypad
Please insert the security code:
Error running script: Error compiling expression 'result="357289"': Unknown object or variable 'result'
I've tried it with other codes to and it never works. I think the problem is it's not recognizing "result" as a command but I don't know what to do instead.
The Pixie
26 Mar 2015, 07:48I would guess that you have put the "If" expression after the "Get input", rather than as part of it. If you look at the image on the page you linked to, the "If" statement is indented, so the "If" is under the ^, showing that it belongs to the "Get input". When adding scripts to the "Get input" itself, you need to click the indented "Add new script" button.
If that does not work, could you either upload your game or paste the code here so we can see it properly?
If that does not work, could you either upload your game or paste the code here so we can see it properly?

XanMag
27 Mar 2015, 19:21Not sure if this would work for you, but I made two commands in the room with my keypad. One command when entering the correct code was something like 'type 12345' that ran a script opening the door and another command for the wrong code was 'type #text#' followed by my wrong answer script. Of course you'll need to prompt the gamer with text on how to write the correct response. I think I had a response to the 'use keypad' command that said something like, if you think the code is 12345, then just <i>type 12345</i>.
If those commands are incorrect, I'll edit this when I get home. Good luck!
If those commands are incorrect, I'll edit this when I get home. Good luck!