Ask a question confusion

For help with creating games using Quest

Moderators: Pertex, Alex, sgreig, Cryophile

Ask a question confusion

Postby tingtingminer » Tue Aug 07, 2012 10:57 pm

I am currently making an adventure requiring asking questions. If you enter the scripts menu and scroll down to ask a question, when you have set the question, I can only see 1 option for the script, and when I test it if I click yes or no It does the same thing. Is there any way I can make it so it runs a different script for yes or no.

Thank You :D
tingtingminer
 
Posts: 3
Joined: Tue Aug 07, 2012 10:53 pm

Re: Ask a question confusion

Postby Pertex » Wed Aug 08, 2012 6:32 am

Could you append your game here? It's hard to say anything about your problem if we can't see your code
User avatar
Pertex
 
Posts: 1103
Joined: Fri Jul 09, 2010 9:52 am
Location: germany

Re: Ask a question confusion

Postby mazzy15 » Tue Jan 01, 2013 9:40 pm

I am having the same problem. There is no option to make two different answers, which is irritating.
mazzy15
 
Posts: 2
Joined: Tue Jan 01, 2013 9:31 pm

Re: Ask a question confusion

Postby The Pixie » Tue Jan 01, 2013 9:47 pm

For a yes/no question, use the "ask" acript command. The result goes in a variable called "result", true for yes, false for no, so you need to check that value.

Here is some example code to do that:

ask ("Are you sure?") {
if (result) {
msg ("Let's do it then!")
}
else {
msg ("Nevermind then!")
}
}
The Pixie
 
Posts: 391
Joined: Mon Aug 01, 2011 7:43 am

Re: Ask a question confusion

Postby mazzy15 » Wed Jan 02, 2013 11:59 pm

the only 'ask' script I can find is an 'ask question' script.

it says, 'Ask question', in a box 'text' which you can change to 'expression'. then a text box to write the question. underneath it says, 'after choosing, run script.' with an arrow.
mazzy15
 
Posts: 2
Joined: Tue Jan 01, 2013 9:31 pm

Re: Ask a question confusion

Postby Alex » Thu Jan 03, 2013 12:00 am

You can check the result by looking at the "result" variable - you can put it inside an "if" expression.

For example, add an "if" script and set the expression to "result". The script inside the "if" will only run if the user selected "Yes". Use "Add Else" to add a script to run if the user selects "No".
User avatar
Alex
Site Admin
 
Posts: 2087
Joined: Fri Jun 27, 2003 11:06 pm
Location: London, UK

Re: Ask a question confusion

Postby HegemonKhan » Thu Jan 03, 2013 9:13 am

Do you want a question with the answer choices of "Yes/No" (only 2 options-responses), or do you want a more open question and-or being able to have more answer choices than only just 2 options-responses ???

-----------

like the others have already stated above:

when using the 'Ask A Question' script, this (only a single example though) is how it works:

Add A Script -> Output (Ask A Question) -> Ask question [text] 'Are you dead?', after choosing (Yes or No), run script:
-> Scripts (If...) -> If [expression] 'result', then:
->-> 'Output (Print a Message) -> Print [message] 'You go to the afterlife' (this is for the Yes choice you clicked on)'
->-> Add Else -> 'Output (Print a Message) -> Print [message] 'You stay on the earth' (this is for the No choice you clicked on)'

--

an alternative method, is to do this, instead:

Add A Script -> Scripts (If...) -> If [player answers yes to] [question] 'Are you dead?', then:
-> 'Output (Print a Message) -> Print [message] 'You go to the afterlife' (this is for the Yes choice you clicked on)
-> Add Else -> 'Output (Print a Message) -> Print [message] 'You stay on the earth' (this is for the No choice you clicked on)'

-----------

if you want to ask a single answer question that produces an attribute or a variable, then you use Get Input script:

Add A Script -> Output (Print a Message) -> Print [message] 'What is your name?'
Add New Script -> Output (Get Input), then run script:
-> Variables (Set a Variable or Attribute) -> Set variable 'player.alias' [expression] 'result'

----

You can also use show a menu (after the Get Input script) to bring up a menu with several answer-options to choose from (and then you can set an attribute or variable to that result ou choosen):

Add A Script -> Output (Print a Message) -> Print [message] 'What is your name?'
Add New Script -> Output (Get Input), then run script:
-> Variables (Set a Variable or Attribute) -> Set variable 'player.alias' [expression] 'result'
-> Add New Script -> Output (Show a menu):
->-> the menu's question -> 'What class are you?'
->-> the menu's choices -> split ("warrior;thief;barbarian;wizard" , ";")
->-> the menu's asking of if you want to be able to cancel your menu choice -> [no]
->-> Add New Script -> Variables (Set a Variable or Attribute) -> Set variable 'player.class' [expression] 'result'

lastly, you can use the Scripts (Switch...) :

(this is continued from above script block, in this example of mine)

->-> Switch (if) 'player.class'
->->-> Case (is a) 'warrior', then... like setting attributes (player.strength = player.strength + 1)
->->-> Case (is a) 'thief', then... like setting attributes (player.agility = player.agility + 1)
->->-> Case (is a) 'barbarian', then... like setting attributes (player.endurance = player.endurance + 1)
->->-> Case (is a) 'wizard', then... like setting attributes (player.intelligence = player.intelligence + 1)

----

these are all just examples of mine, of (at least some of the) different types of "questions" you can do in quest

and for my examples, you can replace the variable (set a variable or attribute) with output ( print a message [message or expression] ), if you want answer type responses too. Or, you can use whatever script type choice you want as well of course.

for loose (coding not included lol) example :

Do you want to explore the desert or the tundra?
if choice is desert, move player to desert room
if choice is tundra, move player to tundra room
HegemonKhan
 
Posts: 951
Joined: Thu Dec 06, 2012 8:11 am
Location: CA, U.S.


Return to Quest Forum

Who is online

Users browsing this forum: No registered users and 2 guests