Indexed Text and Multiple Text Reporting

Hi all, I think this might be an easy question, but maybe not. I have a lot of stuff happening at once, through multiple functions. Problem is, I don’t want to have each output or resolution of what’s happening in each function be on a separate line, using individual say “(resolution)”, because this creates a huge scroll of text. Is there a way to store text in a dynamic variable, and keep adding to that variable, and then report it once, once all of the resolutions of each function have completed? For example, if I have a loop that goes through ten different characters and is returning an action for each, I would like to have this consolidate into one paragraph. Is there a way to index text, report it, and then throw it away?

Sorry if I’m not making too much sense. I can come up with a code example if need be. I think I’ve seen something called ‘indexed text’, but haven’t been able to figure out how to make it work.

Thanks for any help!

This is possible but not easy.

See the “Social Groups” chapter of the recipe book: inform7.com/learn/man/Rdoc62.html . The “Happy Hour” example does something like this, though without indexed text.

Hello Craftian,

I’m not sure I quite understand you. Are you saying you want the results of the functions to print as “A. B. C.” instead of
A.
B.
C.?

If that’s the case, you can end the sentences in your say phrases with a period and a space instead of just a period. That tells Inform not to put a paragraph break after each one.

Yeap! That’s exactly it. I have potentially dozens of text reports coming out of functions at one time. In this scenario, there are about 30 creatures and a dozen NPC’s in the same room, all with individual actions and resolutions, happening at once. Everything is coming out right with the numbers, and all of the resolutions are ending beautifully, but the text reporting is wonky, because each resolution is given its own line. I’ll have to add my own adjustments on how to string together each text in the report, so the end result of each turn is a consolidated paragraph that is dynamic for every situation.

Thanks for the help! I’ll try this out as soon as I can.

I have done something similar to this. I create a list of indexed texts, and add descriptions to the list.

This would output “Mary had a little lamb. Whose fleece was white as snow. And everywhere that Mary went. The Lamb was sure to go.”

If you make the list of indexed texts a global variable, each separate function can add to it. Just be sure to truncate it at the start of each turn.

What happens if you add “[run paragraph on]” to the end of each output/resolution? Like this:

[code]First room is a room. Second room is north of first room.

After an actor going from First Room: say “[The person asked] goes [noun]. [run paragraph on]”.

Jane is a woman in First Room. Alice is a woman in First Room. Jerome is a man in First Room. Maurice is a man in First Room.

Every turn:
repeat with NPC running through persons in First Room begin;
if NPC is not the player begin;
try NPC going north;
end if;
end repeat.[/code]

Test this with “z”. As you can see, you have to include something to make sure the command prompt doesn’t wind up on the same line as the output (!), but the output winds up all on one line.

There’s another issue, that “Jane goes north. Alice goes north. Jerome goes north. Maurice goes north.” is pretty stultifying even in one paragraph. You’d want “Jane, Alice, Jerome, and Maurice go north” or even “A bunch of people go north.” But getting that to happen would be hard.

There’s an example of that in the documentation, I believe it’s called “Gelato” and listed in the old section on procedural rules. EDIT: It’s “Patient Zero” in “Consider is not the same as Follow”.

Thanks to everyone for the suggestions. This is immensely helpful, and actually right on time – the last few things I’m dealing with in the combat module are pretty much answered in this thread. I’m at the stage now where I try to do things that I have no idea will work, off the top of my head, thinking I’ll get a ton of errors, and then it works. This is an immense amount of fun, and its eating up most of my free time.