Using a Switch

Creativita
27 Mar 2012, 11:43
I am trying to use a switch so that the player may answer yes or no to the question "do you want to get out of the car and run away," at one point in my game. I have followed the "Multiple Choices" tutorial and my script seems identical to the image. Can anybody refer to the image to the image I have attached and tell me what I have done wrong? Is there another way to ask the player a question in this context?

I know that the event isn't incredibly plausible but I am just using a basic story for my practice game.
Quest Screenshot 1.PNG

Pertex
27 Mar 2012, 12:23
Have a look at the wiki. There is the ask command http://quest5.net/wiki/Ask_%28script_command%29 for yes/no-questions or the Getinput command http://quest5.net/wiki/GetInput for textinput (Getinput will change in the next version of Quest so its better to wait for the change).

Alex
27 Mar 2012, 13:28
You need to use an expression for the case key. This means if you use yes or no, Quest will be expecting a variable of that name.

To fix the problem, use quotes around the expression, like this:


"yes"
"no"

sgreig
27 Mar 2012, 20:41
You could also use the "if player answers yes to question <blank>" script that Alex demonstrated during his webcast presentation today. That would be even easier. The game would pop up a window prompting you to click yes or no and then continue from there.

Creativita
27 Mar 2012, 22:01
Thankyou everyone. I originally was using the ask function but I would prefer to use text input.

Creativita
28 Mar 2012, 11:56
Are you able to use a key that is longer that one word.

Alex
28 Mar 2012, 16:09
"as many words as you like"

Creativita
28 Mar 2012, 22:00
Why is that I am having difficulty using a switch in the same way to ask a character a question? I have made sure to follow your instructions.

Pertex
29 Mar 2012, 06:52
You must be careful! If you use a key "who are you" with the ask-command in the ask/tell tab, every single word of the key is evaluated. So if you "ask man about are" the keyscript is executed.
In your switch in your say-command the complete key is evaluated, so "say are" doesn't match the "who are you" key

Creativita
29 Mar 2012, 08:42
Thanks again. I'll make sure to do that.