Efficiently Achieving Responsive Room Descriptions

Good morning everyone.

I’ve always written room descriptions that are reflective of what’s going on. This means I have a lot of room descriptions which fire depending on whether things like the papers are tidied or the scratch is polished or they both are or neither are etc.

I’m happy to do this work to make sure the game is reflective of the environment but I got to wondering if there was a more efficient way to achieve this same result.

Perhaps short descriptions take care of this so there’s not really a need.

Maybe I’m doing unnecessary work.

2 Likes

Inform’s inline [if …] text substitutions are very convenient for this. If you have a bunch of different properties that can vary, Inform makes it relatively easy to vary the descriptions based on each of them.

Another option is to use a “rule for writing a paragraph about” a notable object whose description varies. This is also helpful if the object can end up in different places.

4 Likes

I also tend to write very complex room descriptions sometimes, and these are all great techniques. The one I’d add is that if you have a description that’s going to change substantially after an event – maybe your perspective shifts, or a room floods, or something like that, you can replace a description wholesale, by saying

Now the description of ROOM is "BLARG."

I found that helped me manage when the complexity was getting a bit overwhelming!

4 Likes

One neat way to accomplish complicated varying descriptions is with the use of the To say statement.

Example:

The description is "This is a room. In the room is a [TableDesc] and a [WindowDesc]."

To say TableDesc:
    if the table is XXXX;
       say "XXXXX"
   otherwise if the table is YYYY:
       say "YYYYY"... etc

I’m typing off my mind, so grammar may be incorrect. Also, sorry for not providing a link to the manual :slight_smile:

4 Likes

Thank you everyone. Those are good tips. I’ve used the top two before but never the bottom one.

What is the advantage of using @Jamespking 's suggestion vs. the If of @Draconis , or vice-versa?

2 Likes

Per example, To say can provide far more complex layouts. Even with other variables inside (iirc you cannot nest ifs in statements).
And they are reusable somewhere else (like in object present in more than one room).

2 Likes

If you look down to the subsection on “Looking” in Backstage Activities here, it depicts the flow and relation of the activities involved in room descriptions. You can see details about each activity in WI 18: Activities. It’s not easy to get a handle on how, but there’s a lot of ability to customize.

For instance, for your tidy or messy papers:

Some papers are a thing.
Some papers can be tidy or messy.
Some papers are messy. [with two choices it defaults to second, so not strictly necessary]
Understand "messy" as some papers when some papers are messy.
Understand "tidy" as some papers when some papers are tidy.
For printing the name of some papers:
  say "some [if some papers are tidy]tidy[else]messy[end if] papers".

And now you automatically get the messy/tidy indicator wherever the papers are, no matter what room they’re in, or if they’re in your inventory. (And Daniel already mentioned for writing a paragraph about.)

But that’s not applicable to scenery, which have to be in the room description if they’re to be mentioned at all. So for things with straightforward either-or choices, use [if...] in the room’s description property like Daniel said; for more complicated things, follow James’ suggestion.

This is possible (in 9.3/6M62; doesn’t work currently in 10.1 due to a bug):

This is the lab-desc rule:
  [arbitrarily complicated code to print the room description in lieu of just saying the room's description property]

The lab-desc rule substitutes for the room description body text rule when the location is the lab.

…but I think it makes it a little harder to follow what’s going on than James’ suggestion.

3 Likes

As a side note, you don’t have to call them “some papers” every time. If you’ve used “some” the first time (to establish that they’re plural-named), you can call them “the papers” everywhere else and get the same effect.

1 Like

I know; it was just a bit of reflexive defensive coding against the possibility that there could be another object with “papers” in its name, which may seem over-cautious, but, even if so, at a cost of a single character more than “the papers” per invocation, it comes with little expense.

1 Like

Yes. Ultimately, if you want a room description to be really live, based on the status of lots of things in the room (and it sounds like the OP does) you probably need to go with a bunch of Say statements. Both because you can’t nest too many [if …]s inside each other, and they can’t test more complex conditions, and/or interactions with more complex conditions. The final thing is you often need to finesse the prose to transition nicely just in a certain position in a room description in a certain room, and that’s also best handled with the ‘bunch of says’ method.

If I can get away with just writing some [if …]s and/or tweaking rules for writing paragraphs about, I’ll do it. As soon as the requirements get above a certain level – or just because it’s my habit now and I like doing it anyway – I break out ‘A Bunch Of Says’.

-Wade

4 Likes