Question about questions

Balerod
10 Jun 2006, 11:58
Hello everyone!

I'm using QDK Pro to develop my first Quest game. What I would like to do is ask the player a question, and then wait for a yes/no response. I can see how to handle the response, but how do I ask the question, then wait for the player to respond? This is what I'm trying to do:

The player is holding a food item he is allergic to...

Player: Eat <food item>
Quest: You are allergic to the <food item>. Are you sure you want to eat it?

Player: Yes
Quest: <prints a message, then kills player>

I am attempting to do this in the <food item's> "eat" action script.

Thanks for any help you all can provide.

Balerod

steve the gaming guy
10 Jun 2006, 13:36
If you open it in notepad (by changing the 'files of type' to .asl instead of .txt) then your code should look a little something like this:

                if ask <You are allergic to the #@food#.  Are you sure you want to eat it?> then {
msg <You were so allergic to the #@food# that you died.>
playerlose
}
else {
msg <You decide it would be wise not to eat the #@food#.

}


If you do it in QDK, you could either make allergic foods properties/actions [in the QDK help manual, search for potato or food] or stick to the yes/no question as follows:

In this example, I am using the room's properties to create the command. Open the room property window and go to the Misc tab.
Click Edit Custom Player Commands.
The Player Commands window pops up and you will click Add to type in the command that prompts the question. (e.g. eat food)
Further down will be an edit button. Click it.
In this new window that pops up, click the Add Conditional button.
In the 'IF' section, click Add.
The 4th option down is "The player answers 'yes' to a question".. click that.
To the right, you will have a space to write your question (e.g. You are allergic to #@food#. Are you sure you want to eat it?)
Click Ok and then click edit on the Then section.
In this window, add a message and add a lose game command. (which is after you "add command", it is under Finish the Game/Finish the Game by making the player lose)




That should give you something to work with.

Balerod
10 Jun 2006, 19:16
Thank you Steve!

You were very helpful, and I got what I needed to do done.
I didn't even think of trying the "player answers yes to a question" conditional. I guess I should go RTFM :oops:

Thanks again!

Balerod