Adding the same text to multiple choices

Today’s question:

I’m working on branching choices at the end of a game, and I’m having trouble coming up with the language to allow me to add end notes to each choice without repeating the end notes for every choice.

Like this:

To say talk to instead:
	if the noun is the frog:
		if the player is choice1:
			say "A bunch of stuff[paragraph break]";
				wait for any key;
				clear the screen;
				say "A bunch more stuff.[paragraph break]Oh, dear. That decision didn't work out well. Would you like to rewind and make a different choice?>";
				if the player consents:
					rewind occurs in zero turns from now;
				otherwise:
					say "[paragraph break]Here's the end stuff.";
					end the story;
					say "[paragraph break]Would you like to read the game's end notes?>";
					if player consents:
						say "End notes.";
          otherwise if the player is choice2:
              etc, etc

But I have 10 choices, and the end notes are long, and I don’t want to have to put them in for every choice. I’d like something like:

Understand the command "finish" as something new. Understand "finish" as finishing. Finishing is an action applying to nothing.

Report finishing:
	say "end notes.".

And then change the end of my previous code to something like this:

yada yada yada:
otherwise:
	say "[paragraph break]Here's the end stuff.";
	end the story;
	say "[paragraph break]Would you like to read the game's end notes?>";
		if player consents:
		   report finishing.

But of course it doesn’t like “report finishing” used that way.
I also tried this:

 At the time when storyends:
	say "end notes.".

and then changed the end of my code to this:

otherwise:
	say "Here's the end stuff.";
	end the story;
	say "[paragraph break]Would you like to read the game's end notes?>";
	if player consents:
		the storyends in zero turns from now;

But that doesn’t work because I guess consenting doesn’t count as a turn. And saying “now the storyends” doesn’t work.

I am really struggling to keep my code non-repetitive so that everything isn’t so long. I know this is probably really easy, but I just can’t find how to do it.

I think you want to define a phrase that’s something like “to say end notes” that includes all the text you want to include, then just invoke it at the appropriate times. Check out the docs and examples here and the following section or two.

2 Likes

Yup, easy. Thank you… that was exactly what I needed. :grinning:

1 Like