Anticipating text

More than once, I’ve been stopped by the issue of predicting whether the game is going to print something interesting. Because the approach of Inform (6&7) seems to be to avoid passing texts around, and only printing anything at the last possible minute, we often have completely separate rules for deciding whether to say something and deciding what to say. This can make for some intricate logical gymnastics. I always think of Choosing Notable Locale Objects vs. Writing a Paragraph About as a good example of this. Describing the contents of scenery supporters is a common question, and I’ve also dealt with distant objects added to scope using these activities.

Writing a Paragraph About is a piece of work in itself. I always assumed there was some “activity succeeded” check that would decide whether the parameter-object had been mentioned yet. Turns out, there’s this rather obscure thing instead:

if a paragraph break is pending, say "[conditional paragraph break]"; carry out the writing a paragraph about activity with the item; if a paragraph break is pending: increase the locale paragraph count by 1; now the item is mentioned; say "[command clarification break]";

More recently, I’ve started looking into the conversation system for my WIP. This is the fundamental method:

  1. PC says something.

  2. NPC consults a rulebook which searches through multiple tables to see if they have an interesting response.

  3. Do some stuff based on whether or not there was an interesting response.

  4. Maybe print the interesting response, based on some other decisions.

Right now I’m using a phrase that returns a text to check for interesting responses, but it bothers me because it feels un-informish. Plus, unless I save the text in a variable, I might end up running the rulebook multiple times in a turn - and I’ve noticed that the game is already slow in Parchment.

In the new conversation system I’m setting up, I have two activities that might help. One is called “getting attention,” which attempts to see if an NPC wants to say something about the situation any time a character does or says anything, and the other is called “choosing motivated speakers,” which runs every turn. The latter actually borrows the Table of Locale Priorities to do its work, since it works very similarly. Once this activity has decided who is going to talk, I carry out the “handling conversation” activity, which does the printing. I’m much happier with this setup, but I don’t think I’ve successfully avoided the problem of having to run a rulebook to see whether an NPC has a response to a particular subject.

How have you dealt with this sort of situation? Do you try to work with Inform? Do you build tables? Do you just end up passing text around? Or is there some sort of clever paradigm that I’m missing?