How do I make a multiple choice question?
Galactic_Comet
12 Nov 2016, 06:56Okay, so in the game I'm trying to make, someone asks the player a question. Then what was going to happen in my head, was that it will show a menu with the possible answers, and the player has to pick from them. I used the show menu thing from Quest Docs' Character Creation but can't figure out how the person will reply to the player's answer.
Should I use set attribute or set flag? or something different?
Help me, please.
The Pixie
12 Nov 2016, 09:48ShowMenu will set a variable called result
that will hold a string that is the selection the player made. You can set an attribute to the if you may want to know what it is later.
hegemonkhan
12 Nov 2016, 11:39here's a thread to help you understand Attribute and the 'if' Script usage:
http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk
and if you want to see more advanced character creation stuff, at least for ideas, take a look here:
http://textadventures.co.uk/forum/samples/topic/4988/character-creation-crude-code-and-sample-game
to add on to what Pixie said:
'show menu (parameters)', ShowMenu (parameters)', and 'get input' do this automatically (hidden from you):
result = YOUR_TYPED_IN_OR_SELECTED_INPUT
you can now use 'result' in an 'if/else if/else' Script block or the 'switch' Script, or store (set) it into an Attribute, so you can use it anywhere/anytime/repeatedly, so long as the Object containing it, exists or still exists, of course.
XanMag
13 Nov 2016, 16:16An alternative option if you are interested is to make a "homemade menu" that requires a typed response.
Below is the explanation from my tutorial game.
- I added object Minnie Menu
- I went to the 'verbs' tab for Minnie.
- I typed in 'speak...', at which point I selected the built-in speak; speak to; etc option.
- I chose to print a message that included Minnie's response. She mentions five things you could ask her about. I printed it as a numbered list.
- I added a 'Get input, then' script, followed by a 'Switch' script.
- In the 'Switch' script, I discovered an absolutely beautiful bit of code... If you type in LCase(result) in the Switch box, it will take whatever the player types in and make it all lowercase!! If you do this, you do not need to worry about (or account for) a player that types in all CAPS or uses correct capitalization. CATS = cats, Cats = cats, CAtS = cats. It's a nice little tool!
- Under the 'Switch' box there is a plus sign next to the word 'Cases:' Click on that.
8a. For option 1 in the menu, I added this as the case "1","one","tutorial","this tutorial","game","the game","the tutorial"
8b. What this does is it accounts for anything that the player may type in that indicates that they want to talk about the first thing in your homemade menu. I repeated this basic procedure for the next five cases. - When the player types in a response that matches one of your cases, you need to add a script that runs the appropriate response.
- Be sure to add a default response. A default response will take care of anything the player types in that does not match one of the cases.

Anonynn
13 Nov 2016, 18:51menulist = Split("text;text", ";")
ShowMenu ("Question Here.", menulist, false) {
if (result = "") {
}
}
So how you use this is...
Split("Choice1;Choice2", ";")
ShowMenu ("If you want to use this you can but you can also leave it blank. What food would you like to eat?", menulist, false) {
menulist, false ((this is asking if you want the player to be able to ignore the script. True is no, false is yes.)) {
if (result = "Choice1") {
}
if (result = "Choice2") {
}
}
Hope this helps!