An exception to a limitation in "After reading a command"?

Hey All–

I want to have multiple instances where I ask the player a question and they pick a numbered option as their answer, for instance:

Which is your Mom’s favorite cake?

1.) Chocolate
2.) Vanilla
3.) Lemon

And then the player would pick a number and the game would ask them a follow-up question with more numbered choices. Like if they picked chocolate, it might then say,

Oho, she’s a chocolate lover! Which way does she like it:
1.) With chocolate buttercream
2.) With vanilla drizzle icing
3.) With sifted powdered sugar

And then the game would give them the cake they choose. I also have a scoring system which would track this (which I have working).

I’m just doing this with “after reading a command,” because doing that means I don’t have to tackle a scary extension like “Questions.” Eg (assuming the player has triggered the question and is now cake-asked):

After reading a command:
	if the player is cake-asked:
		if the player's command matches "1":
			now the player is chocolate-chosen;
			say "Oho, she's a chocolate lover! Which way does she like it:[line break]1.) With chocolate buttercream[line break]2.) With vanilla drizzle icing[line break]3.) With sifted powdered sugar[line break]";
		otherwise if the player's command matches "2": 
			etc;
		otherwise:
			say "Answer the question! Which way does she like it:[line break]1.) With chocolate buttercream[line break]2.) With vanilla drizzle icing[line break]3.) With sifted powdered sugar[line break]";
	otherwise if the player is chocolate-chosen:
		if the player's command matches "1":
            now the player if cake-picked;
			now the chocolate cake is in the location;
			say "ZAP! A plate of your Mom's favorite chocolate cake appears.",
		etc;

That all works fine. However, and here’s my question:

I want to allow the player to be able to access information about their family members while they’re choosing so they can pick the right cake. So I’d like to have a line like “unless the current action is remembering” in there so that the player can REMEMBER stuff before making a choice, but can’t do anything else until they make a choice. Either I have not been able to word this correctly, or you just can’t do this with “After reading a command” rules, since this compiles but Inform just ignores it.

I may have made that question more complicated than it needs to be. Bottom line: restricting the player from doing anything except remembering until they answer a question. Hopefully this can be done with the format I’m using (After reading a command).

1 Like

Oh, I think I solved it. I finally hit on the right syntax.

2 Likes

Hi @AmandaB! :slightly_smiling_face:

I think it would be nice for other members / future searchers if you shared the solution you found.

Excellent point. Of course you’re right.

I’m sure this makes good coders flinch, but the way that works in my system (using “After reading a command”) is to say:

if the player's command matches "remember":
      try remembering instead.

It’s the only thing out of about a dozen different ways I tried that actually works.

For the smart people reading this who are twitching with unhappiness at how ugly this system is: I DID look at extensions like “Questions” and read all the documentation and examples. But I just couldn’t wrap my mind around how they’d work for my application and I knew I could do it this way.

2 Likes

Nah, I’d say that’s actually a fine way to use “after reading a command”. You’re basically replacing the parser completely for this certain section of the game. I’d expect this is what Questions does too.

My gripe is when people use “after reading a command” to parse certain actions and the normal parser to handle the rest, because there are inevitably so, so many pain points when the two don’t quite work the same.

3 Likes