Rule for writing a paragraph about VERSUS... this other way


Every now and then I break out a “rule for writing a paragraph about” to create a dynamic description of something. Then for long periods of time, I forget that method, and go along doing it via custom say phrases inside descriptions.

e.g. "The description of the funky chair is "[funky-chair-desc].".

When I remembered, today, that you can’t go altering variables during the course of such a say phrase, due to the fact they may get altered twice as Inform assesses the text output (and therefore can actually prevent the initial condition you wanted to react to from being reacted to)… I thought, "Should I just be doing all these via “Rule for writing a paragraph about(s)” anyway?

I guess I’m trying to settle on a style, if one way is inherently better than the other. I’m now leaning towards the “rule for writing a paragraph about” style to write dynamic descriptions, unless there’s any reason you folks know not to do it that way?

I also have this memory of @zarf saying in passing that saying “[funky-chair-desc].” is a processing slowdown or something. Or maybe he was just advising against the method because of the aforementioned fallout if you run state-altering code during the enclosed say phrase.



PS - Bleh, I actually forgot the case I’m most interested in.

For a room descipription, you can’t use “Rule for writing a paragraph about”, can you? But that’s when I’d most like to use such a rule. Is there an activity that handles that that I’ve missed? Or do you need to do something via the looking action?


Well, in an extremely minor way. Doing it once per room description isn’t going to cause a noticeable problem.

By the way, you probably meant “initial appearance” rather than “description”.

Ah yeah, for things, I did, though you’ll see why I was thinking about the description via my PS.

So after thinking about this longer than usual without interruption, and playing around, I realise the idea is that you probably don’t want calculations to be performed as part of the action of the printing of a room description. It is loopholey in various ways. (e.g. what if the player’s in BRIEF?) and so better practice would be to put those in every turn rules and such.

Therefore I’ll stick with my style of “Description of throne room is [throne-room-desc].” when I need it for rooms, but switch to “rule for writing a paragraph about” for dynamic initial appearances of things.


1 Like

Well… you can, you just need to make sure that your state-changing code is made contingent on the phrase not being run because text is being ‘expanded for comparison purposes’.


unless expanding text for comparison purposes: now magic-statue-examined is true.

See here and here


Heh, it’s slightly embarrassing to be reminded of something I forgot again. But I think for me, I just want to get away from running code during a room description’s say phrase because my history is – it always gets me in trouble. And I usually am doing it to alter the description at the same time.


The big difference under the hood is that “writing a paragraph about” can have any sort of conditions in the preamble, and you can have as many rules as you want, which are sorted based on specificity.

They’re also very useful for describing multiple things in a single rule, since anything whose name is printed gets its “mentioned” flag set (and thus won’t get described again later).

For example, here’s a snippet from my ECTOCOMP entry.

Definition: a thing is personal rather than impersonal if it is the notebook or it is the lantern.
Definition: a thing is unhandled if it is not handled.
Rule for writing a paragraph about an unhandled personal thing:
	say "Your possessions lie scattered all over the floor, where they fell during your daring entrance. You see [a list of personal things in the location] amid the dust."

This automatically captures all personal things in the starting location, as long as any of them are unhandled. This would be a big pain in the ass to do with initial appearances.

For another example, there are a few different “hangers” in the game that you can hang some wind chimes on. The most important thing about a hanger is what’s on it, so I override the initial appearance (and any other “writing a paragraph about” rules) in that case:

Rule for writing a paragraph about a hanger which supports the chimes:
	say "Some [wind chimes] hang from [the holder of the chimes], silent in the still air.".

And now I don’t have to put this code in the initial appearance of every single hanger. Or even have an initial appearance for every hanger, I can have some be scenery if I want.

An initial appearance is basically a shorthand for this. You can think of it as a fallback rule: there’s a default “writing a paragraph about” rule that prints the initial appearance if it exists. (Technically it’s part of a different activity, but the effect is the same.) So they’re two different mechanisms to accomplish the same result, sort of like the “printed name” property and a “rule for printing the name of”.

And to finish it off, room descriptions are different in that they’re tied to the room rather than the thing, so it depends if you care about where the thing is when it gets described.