Multiple-choice responses

Hello. I have a custom “talking to” action, as defined here:

Talking to is an action applying to one visible thing. Understand "talk to [someone]" or “converse with [someone]” as talking to.

Check talking to: 
	say "[The noun] doesn't reply.";

How do I let the player pick what to say, for example:

The boss is a person. 

Instead of talking to the boss:
	say "The boss frowns. 'Issue with my staff?'";
	say "'Your staff have been stellar.'";
	say "'Then what do you want from me?'";
	say "(1) Ask about the coded message";
	say "(2) Ask for a job";
	say "(3) Ask for free food";
	say "(4) Ask for a duel";
	[How to do this..?]

Some help here would be appreciated.

1 Like

The Hybrid Choices extension is probably what you’re looking for, or perhaps Questions. Look at the documentation for each extension (at the bottom of each program) and see what works better for you. If you’re still confused, let me know and if I have time I can make example snippets with each.

1 Like

Hello, thanks for the swift and helpful reply.

I tried to use Questions, because Hybrid Choices seemed less Inform 7-like.
This is my code so far:

	ask a closed question, in number mode;
	if the number understood is 1:
		say "1";
	else if the number understood is 2:
		say "2";
	else if the number understood is 3:
		say "3";
	else if the number understood is 4:
		say "4";
	else:
		say "Invalid choice";

I mean, it kind of works. It just bugs out like crazy. Some pointers would be useful.

When you say that it bugs out like crazy, can you share what it does? Does the code compile?

It compiles and runs, all right, but it doesn’t show the input field and runs the code inside “else” instead.

From the Questions documentation:

Before we ask a question that requires an answer from a menu of options, we need to set the menu items to be displayed. We do this by setting the variable “current question menu” to the list of options that we require.

Example Location is a room. 

Include Questions by Michael Callaghan.

Talking to is an action applying to one visible thing. Understand "talk to [someone]" or “converse with [someone]” as talking to.

Check talking to: 
	say "[The noun] doesn't reply.";
	
The boss is a person in Example Location. 

Instead of talking to the boss:
	say "The boss frowns. 'Issue with my staff?'";
	say "'Your staff have been stellar.'";
	answer the boss;

to answer the boss:
	now the current question is "'Then what do you want from me?'";
	now current question menu is { "Ask about the coded message", "Ask for a job", "Ask for free food", "Ask for a duel" };
	ask a closed question, in menu mode;	
	
a menu question rule (this is the boss response rule):
	if the current question is "'Then what do you want from me?'":
		if the number understood is:
			-- 1: say "'...What coded message?'";	
			-- 2: say "'You have a job already. You don't need another one.'";
			-- 3: say "The boss gives you a cracker.";
			-- 4: say "The boss silently raises his butcher's knife. You decide not to engage.";

to ___ creates a function. You don’t need this and can put its contents inside the talking code if you want.

I wrote an extension for this that I don’t think anyone has ever used, Inquiry.

With Inquiry, this would be:

Include Inquiry by Zed Lopez.

Boss-talk is an answered multiple-choice inquiry. "The boss frowns. 'Issue with my staff?

'Your staff has been stellar.'

'Then what do you want from me?'".
	
The choice-list of boss-talk is { 
"Ask about the coded message",
"Ask for a job",
"Ask for free food",
"Ask for a duel"
}.

Carry out talking to the boss:
now boss-talk is unanswered;
carry out the inquiry handling activity with boss-talk;
if the answer of boss-talk is "Ask about the coded message" [...]

Glaring in hindsight is that it was a regrettable choice to require repeating the text of the choices to test the answer…

3 Likes

Yeah, was reading along and thinking this looked like a neat approach, but that requirement feels a little clunky. Would it be possible to sub in a number or something like that?

MathBrush made a pretty useful extension for a fluid dialogue system, Clues and Conversation, that has helpful documentation.

1 Like

I’m thinking having a kind of value to serve as unique identifier for the answer and a text property on it for the text of what appears in the multiple choice…

1 Like

I will definitely try this out. Also, thanks to all the people offering solutions, you were very helpful :heart:

Thanks so much! I’ve got it working just like I want it to.

Definitely possible to use the index number into the list, which I would prefer over needing to define a new object for every option.

I wouldn’t want to make people change things in multiple places to re-order or otherwise re-number things. I’m thinking maybe:

mc-option is a kind of value.
The mc-options are defined by the Table of MC Options.

Table of MC Options
mc-option     mc-text
boss-code       "Ask about the coded message"
boss-job        "Ask for a job"
boss-food       "Ask for free food"
boss-duel       "Ask for a duel"

the choice-list of boss-talk is { boss-code, boss-job, boss-food, boss-duel }.