Truth States and Alternatives

So I’ve been reading the source texts for several Inform 7 games and comparing it to the source code of my current WIP, and the clearest discrepancy is that the source texts of other games have very few truth states, with the exception of Blue Lacuna, which has about 60 truth states in all its 400,000 or so word source code. Bronze, Reliques of Tolti-Aph, and Child’s Play all have next to none.

Meanwhile, I’m 18,000 words in and already have 28 truth states. I’ve found them highly convenient for various purposes, but, given their rarity in these other source texts, I’m getting a feeling that there may be issues with them that I am not foreseeing.

Here are some of my common uses:

  1. Ending a scene. A scene ends when a truth state is true, and said truth state can potentially be activated by multiple actions or a very specific action in a very specific situation.

  2. As a more generalizable alternative to [if we have verbed the noun], where said action being remembered was in a more specific situation or ended in an Instead rule and thus didn’t register as successful.

  3. Establishing that a specific yes/no question is currently being asked of the player by another character.

It really feels like there’s a better way to do 3, but truth states have worked fine. What are some potential bugs that can easily trickle in with uses of truth states like these? What sort of replacements are possible, and why are they the better choice?

There’s nothing tricky about a truth state. Use it if you want to use it.

If I want to apply a flag to a particular object, I’ll generally say “The umbrella can be blarb” rather than defining a truth state “umbrella-is-blarb”. Same effect, but it often reads better in code.

For your case 3, maybe you want a variable “current-question” rather than a bunch of “question-is-Q1” flags.