[I7] Room Descriptions That Slowly "Decay"

“Slowly decay”? What does that mean?

Okay, so here’s what I’m trying to do and I’m curious to hear thoughts about how to do it well. I have a setup wherein you’ll visit a room and you’ll get the normal extensive description:

Palace Gate
Long description about the room here.
>

A subsequent view of that room will provide a much shorter description.

Palace Gate
Summary description of the room here.
>

Note a subsequent view of the room, meaning the player just walks in to it. I’m not talking about typing “look” here.

The above is all easy enough. However, what I want to do is then have all subsequent views after that not appear (unless the player types “look”, of course). So:

Palace Gate
>

So this is what I mean by “decay.” The room description goes from full to summary (which I handle via if unvisited) but then goes to nothing at all only after that summary view has been displayed.

It’s kind of like Use brief room descriptions set but only after the full description and the summary description have been displayed.

I could set some property on the rooms, I guess, saying “fully described” and “summary described.” In other words, I’m trying to figure out where to put the logic that would say something like “now the room has been fully described”, “now the room has been summary described.” But I’m not sure if that’s a smart way to go about it.

Room description style is a kind of value. The room description styles are Brief, Verbose and Superbrief. 
The current room description style is a room description style that varies. 
The current room description style variable translates into I6 as "lookmode". 

A room has a number called the visited-count. The visited-count of a room is usually 0.
The describe room gone into rule is not listed in any rulebook.

A room has some text called the summary description.

Report an actor going:
	let T be the description of the location;
	if the visited-count of the location is:
		-- 0: now the current room description style is Verbose;
		-- 1: now the description of the location is the summary description of the location;
		-- otherwise: now the current room description style is Superbrief;
	follow the describe room gone into rule;
	now the current room description style is Verbose;
	now the description of the location is the T;
	increment the visited-count of the location.

When play begins, increment the visited-count of the location of the player.

Would that work? It’s admittedly clunky and not idiomatic, but it’s reasonably compact. The better way would probably be to customise the describe room gone into rule, but I think this is more succinct, if unpretty.

1 Like

You can also hand-write your own “decaying” room descriptions with text variations.

Carnival is a room. "[One of]The entire expanse of the midway beckons before you with multiple rides, A roller coaster, a carousel, and go-karts.[or]You are on the midway, that roller coaster looks interesting![or]You are on the midway.[stopping]"

The trick is not to put any important information in the descriptions that go away in case the player misses them the first time, or allow them the full description, say if they examine a “midway” scenery item in this example.

Thank you both for the replies. I will try out both solutions. Just to show the context that I’m fitting this in, I have a little extension I wrote called Contextual Descriptions.

There you can see how I do location summaries. What that looks like can be seen in the story file source itself with the room descriptions. I’ll show those bits here:

Palace Gate is a room. “[if unvisited]Palace Gate is a street running north to south leading up to Kensington Gardens. It was previously part of the Gloucester Road, which is just to the south. According to the guidebook, Gloucester Road was named after Maria, Duchess of Gloucester and Edinburgh who apparently built a house there in 1805.[p]A tide of baby strollers [–] or perambulators, as they call them here [–] surges north along what becomes the crowded Broad Walk. Shaded glades stretch away to the northeast and a hint of color marks the western edge of what the guidebook says is the Flower Walk.[else]This is the Palace Gate street, leading into Kensington Gardens, with the north taking you to [summarize the Broad Walk] and east taking you to [summarize the Flower Walk].”

You can see I have an if unvisited. So I have the first long description. Then everything else is after the else part, which is the summary description. Those “summarize” statements are just to provide the context. So for example how that works for Broad Walk is:

Broad Walk is a room. “A brooding statue of Queen Victoria faces east, where the waters of the Round Pond sparkle in the afternoon sun. Your eyes follow the crowded Broad Walk north and south until its borders are lost amid the bustle of perambulators. Small paths curve northeast and southeast between the trees.”

The unvisited summary of the Broad Walk is “what appears to be the crowded Broad Walk”.

The visited summary of the Broad Walk is “what you have seen is the very crowded Broad Walk”.

I bring all this up just to show the mechanisms that are already in place and what I’m trying to achieve in this context. So here is what it would look like for someone being in Palace Gate (which is the starting location; thus automatic look):

Palace Gate
Palace Gate is a street running north to south leading up to Kensington Gardens. It was previously part of the Gloucester Road, which is just to the south. According to the guidebook, Gloucester Road was named after Maria, Duchess of Gloucester and Edinburgh who apparently built a house there in 1805.

A tide of baby strollers – or perambulators, as they call them here – surges north along what becomes the crowded Broad Walk. Shaded glades stretch away to the northeast and a hint of color marks the western edge of what the guidebook says is the Flower Walk.

>

Now the player perhaps goes to Broad Walk and then comes back to Palace Gate. This is the description they should get:

Palace Gate
This is the Palace Gate street, leading into Kensington Gardens, with the north taking you to what you have seen to be the crowded Broad Walk and east taking you to what appears to be the slightly less crowded Flower Walk.

>

Finally, let’s say the player goes back to Broad Walk (or anywhere else) and then back again to Palace Gate. They would see:

Palace Gate

>

So the idea is sort of mimicking a “mindset” of slowly not “repeating details to ourselves” in our minds; a sort of familiarity with the place since you’ve been there. A “LOOK” would generate the else part of the text for Palace Gate, as normal, of course. Which means, to Hanon’s point, important details could be recovered.

(In that extension I also provide an “impressions” action that lets you recover your “initial impressions” which is effectively the full text of the room by setting the room to “unvisited.”)

I’ll definitely give your ideas a shot here as I work to get this implemented.

That solution basically works! I had to change the above quoted line however, to this:

– 1: now the room description style is Verbose;

Essentially matching the case for 0. This is because I don’t have a summary description as provided in that solution. Rather, the summary description is part of the original description. So basically the first and second times the room location is viewed (without a look), the description is Verbose.

That works because my if unvisited -- else condition provides the appropriate context. Then on any subsequent visit, Superbrief mode kicks.

Björn, I know you said your solution might be considered “clunky” and “unpretty” but, to be honest, I think it’s quite nice. With Inform, I find it’s helpful when the intent and the implementation match up such that any expressivity is not compromised. I would be curious if an attempt to, as you say, “customise the describe room gone into rule”, would compromise that expressivity or enhance it.

I can try to figure out how to do that and report back but for now, I love this solution. Not just because it works, but because I immediately saw how to change it to make it do what I needed to do given a slightly different context (i.e., no separate summary description).

UPDATE: And now that I think about it, I wonder if your original idea of having a separate summary text isn’t a better one after all. Hmmm. I’ll have to experiment. But, once again, the fact that the code was so easy to read and modify means that experimenting is very possible in this case!

1 Like

Ooh, interesting question. I have some ideas but need time to put them into practice. Lemme get back to this.

Thank you, Jeff.

As for my objection to my solution, I really dislike the idiom of storing away the description, swapping it for the abbreviated one, then restoring it post-looking. That’s a spatchcock solution if there ever was one, because it purposely goes against the logic of the actual code. Imagine layering further logic on this routine, and you may begin to sense the danger.

As long as it works, though, it works.

Interesting. So this extension (Description Decay) is basically what I did.

It’s a little different than yours. I ended up going with the summary description but had to account for the fact that some rooms might not have one. But notice I end with this kind of interesting statement:

now the description of the location is the description of the location;

What I do like is that it kept the descriptions separate and clean, as such:

Palace Gate is a room. “Palace Gate is a street running north to south leading up to Kensington Gardens. It was previously part of the Gloucester Road, which is just to the south. According to the guidebook, Gloucester Road was named after Maria, Duchess of Gloucester and Edinburgh who apparently built a house there in 1805.[p]A tide of baby strollers [–] or perambulators, as they call them here [–] surges north along what becomes the crowded Broad Walk. Shaded glades stretch away to the northeast and a hint of color marks the western edge of what the guidebook says is the Flower Walk.”

The summary description of Palace Gate is “This is the Palace Gate street, leading into Kensington Gardens, with the north taking you to [summarize the Broad Walk] and east taking you to [summarize the Flower Walk].”

No “if unvisited … else” logic in the main description. Thus it does make it easier to see, at a glance, what the text will be. Those summarize statements of mine are similar in that they are separate as well:

The unvisited summary of the Broad Walk is “what appears to be the crowded Broad Walk”.
The visited summary of the Broad Walk is “what you have seen is the very crowded Broad Walk”

The unvisited summary of the Flower Walk is “what appears to be the slightly less crowded Flower Walk”.
The visited summary of the Flower Walk is “what you have seen is the slightly less crowded Broad Walk”.

This makes checking my code, in terms of what descriptions will display when, so much easier!

I find a lot of times with Inform I’m okay with some “less than stellar” code (from an idiomatic perspective) if it makes my actual source text much easier to reason about. But I take your point about how that can go too far, perhaps, in terms of maintainability or scalability of code.

I’m not sure I follow. How does setting a value to itself help?

Ha. Quite correct, as it turns out. I don’t know what I was thinking. I just need to do:

say the description of the location;

But then I also realized that when I type “LOOK” in the room, it’s now always giving the full description. And that’s because I don’t have the “if unvisited” thing like I did before. Interesting!

I say interesting because part of what I’m doing this for is a class on development and testing practices. And this is showing how various aspects of design can conflict as you add aspects to your design. So as it turns out I might end up going back to the original after all.

For those who read this thread and might be curious how this evolves, I’m trying to fix the above problem I found which is that if I go with the solution I ended up with, the “LOOK” command now no longer does what I want. So I tried this:

Carry out an actor looking:
	if the location is unvisited:
		say the description of the location;
	if the location is visited:
		if the summary description of the location is not "":
			say the summary description of the location.

The room description body text rule is not listed in the carry out looking rulebook.

However, that leads to an improper placement of the room text and the heading:

> look

Palace Gate is a street running north to south leading up to Kensington Gardens. It was previously part of the Gloucester Road, which is just to the south. According to the guidebook, Gloucester Road was named after Maria, Duchess of Gloucester and Edinburgh who apparently built a house there in 1805.

A tide of baby strollers — or perambulators, as they call them here — surges north along what becomes the crowded Broad Walk. Shaded glades stretch away to the northeast and a hint of color marks the western edge of what the guidebook says is the Flower Walk.
Palace Gate

> look

This is the Palace Gate street, leading into Kensington Gardens, with the north taking you to what appears to be the crowded Broad Walk and east taking you to what appears to be the slightly less crowded Flower Walk.
Palace Gate

So it is working in terms of the description but it’s entirely putting it in the wrong spot. But that makes sense because I unlisted the rule. Sounds like I need to create a new rule and then I guess replace the one? So I tried this:

This is the modified room description body text rule:
	if the location is unvisited:
		say "[the description of the location][p]";
	if the location is visited:
		if the summary description of the location is not "":
			say "[the summary description of the location][p]".

The modified room description body text rule substitutes for the room description body text rule.

And that seems to mostly do the trick. For the first room only! But that logic interferes with the “report actor going” code. Or not so much interferes as it is additive. Essentially, if you go to a location, you get the “report going” text and then you get the automatic look action which is triggering my new code. (Or so I’m guessing.)

And then I realized maybe I just one check on the action:

This is the modified room description body text rule:
	if the current action is looking:
		if the location is unvisited:
			say "[the description of the location][p]";
		if the location is visited:
			if the summary description of the location is not "":
				say "[the summary description of the location][p]".

The only change there is the if the current action is looking.

That seems to do the trick across the board, allowing the two bits of functionality to work in the way I’m intending.

Interesting! One more reply here. So the above “works” but it leads to lots of other issues when all of this is combined. For example, here’s my output for Flower Walk:

Flower Walk

You can see a soccer ball half-hidden among the blossoms.

Gaily colored flower beds line the walks bending north and west, filling the air with a gentle fragrance. A little path leads northeast, between the trees.

The spires of the Albert Memorial are all too visible to the south. Passing tourists hoot with laughter at the dreadful sight; nannies hide their faces and roll quickly away.
Floyd arrives from the west

Here the soccer ball (which is in the location) is printed first. Then the room description is printed. Notice my robot who is set to follow the player has their arrival text printed but it’s no longer spaced appropriately.

Which leads me back to realizing my original design (with the “if unvisited … else” and without the summary description) is probably the better way to go. The further I keep going, the more I keep running into mechanisms of Inform that have to fire in the right order. And it’s not always clear how to manipulate the situation.

It’s a pretty cool case study, though, I think in how attempts at certain design can lead to more complication.

Just skimming through the thread, but one solution I’ve done for something similar in the past is to create a new action triggered by the “LOOK” command:

Section - Really Looking

[Looking just prints your immediate surroundings, and we want the command "look" to do that and also tell you about what you can see around you.]

Understand nothing as looking.

Really looking is an action applying to nothing. Understand "look" as really looking.

Carry out really looking:
	try looking;
	gather the visible objects;
	repeat with locus running through the list of currently closely visible objects:
		say "To [the direction the locus lies in] you can see [close description of the locus].";
	repeat with locus running through the list of currently medium visible objects:
		say "To [the direction the locus lies in] you can see [medium description of the locus].";	
	repeat with locus running through the list of currently far visible objects:
		say "To [the direction the locus lies in] you can see [far description of the locus]."
		
Before looking for the first time:
	try really looking instead.

The specific details there aren’t important, but what that did was to have one behavior for the looking action, and another behavior for when the player typed “look”–which did the looking stuff and then some other stuff behind.

(The unimportant details are that the ordinary looking action just printed stuff that had changed, and then if the player typed “look” they got all that stuff plus the stuff that had not changed.)

Anyway, throwing that out in case it helps.

2 Likes

Thanks, Matt. I’ll try that approach as well.

As I played around with my code it was interesting that it wasn’t working because my substitution rule (when I check the Index) is slotted between “room description heading rule” and “room description paragraphs about objects rule”. I see my substituted rule in place of the normal “room description body text rule.”

So I checked the rules and I see what’s happening. Let’s say I go from Palace Gate (starting room) to Broad Walk. I get this:

Broad Walk
[Rule “modified room description body text” applies]
Room description text goes here.

[Rule “Report an actor going” applies]
Room description text appears again here.

So if I go to the Broad Walk, both rules fire thus doubling up the text. Now, let’s say I go back to Palace Gate. Before, with just the original logic Björn provided, everything worked if I took out the summary text part. Once I added in the summary text part in (thus removing my “if unvisited … else” from the descriptions) AND I tried to account for the new “looking” problem, I now get this:

Palace Gate
Shows full description of room.

> north
> south

Palace Gate
Shows summary description of room.

> north
> south

Palace Gate
Still shows summary description of room.

Here the “north / south” is just to indicate I went to Broad Walk and back. Notice with just the original logic in place, the third visit to Palace Gate (as I showed upthread) worked by showing no text (the “superbrief” part). Now, with trying to handle the “look” as well as the “report actor going”, I always get the summary description after the second visit.

So it’s having the two together that causes problems. One thing I did find is that I had to remove the “if the current action is looking:” part that I mentioned earlier. While I thought that was working, it actually made things worse.

It’s an interesting challenge (at least for me) to see how the “looking” logic can be handled when you are also dealing with modifying how text appears and dealing with “actor going to” (which triggers look actions).

BUT – and crucially – if I just keep the original solution Björn provided (minus the summary text description, with the initial change I mentioned to his example) and I keep my “if unvisited … else” statements in the description, that all works perfectly. So from one point of view, this is a case of trying to clean up my source text too much such that it led to a lot of complexity in the code.

Which I think is an interesting example for Inform writers in general. (But then again I would say that considering how much of people’s time I’ve wasted here with this!)

Time spent refactoring is never wasted.

One last point on this. I find I actually do have to set the variable to itself, as I indicated. I just realized this.

If I don’t do that, the descriptions double up. This is without the look logic I’ve been describing in place. So to be clear:

Report an actor going:
	let T be the description of the location;
	if the visited-count of the location is 0:
		now the current room description style is Verbose;
	otherwise if the visited-count of the location is 1:
		if the summary description of the location is not "":
			now the description of the location is the summary description of the location;
		otherwise:
			now the description of the location is the description of the location;
	otherwise:
		now the current room description style is Superbrief;
	follow the describe room gone into rule;
	now the current room description style is Verbose;
	now the description of the location is T;
	increment the visited-count of the location.

The line above that says “now the description of the location is the description of the location;” cannot be set to “say the description of the location” or I get double descriptions printed.

Only if I have the code as stated above (setting the variable to itself), does the code work as intended. (Maybe there’s yet a third way to word it that I’m not thinking of but at least I recovered why I did the seemingly odd thing of setting a variable to itself!)

But, again, if I just remove the need for summary description and keep the Inform mechanism of “if unvisited … else”, I don’t need that logic anyway.

And probably my last reply so the thread doesn’t get too long in the tooth, I also found another interesting issue that was tripping me up.

As some of my above output shows, I have Floyd following the player around.

That’s triggering the logic for “report an actor going” and that was actually triggering the visited-count twice.

I can’t change that to “report the player going” because then Floyd isn’t described as entering the room at all when he follows the player. I did put some if logic in the description decay (as a check for “if the actor is the player”) but that also leads to a series of problems.

I’m also finding the logic is tricky if you go to any other room beyond the starting room that has a summary description or even just uses the original code that I modified from Björn’s example.

So my provisional conclusion is that the idea of “description decay” as I want it is not exactly tenable. You can get bits of it working but then other bits don’t work. Or don’t work consistently depending on various situations, like if an actor follows you, if there’s a locale, if there’s a summary description beyond the main description, and so on. It seems all the bits are coupled together such that disentangling them is really tricky.

I even tried doing something like setting up the previous action and then checking if the previous action was “an actor going.” The problem is you have to do something like this:

The last every turn rule:
    now the previous action is the current action.

And that works just fine. But the setting doesn’t happen until after the room description is printed. So I can’t use the previous action to determine how to display the room description text. You get something like this:

> w

Palace Gate

Current action: looking; Previous action: going east

This is the Palace Gate street, leading into Kensington Gardens, with the north taking you to what appears to be the crowded Broad Walk and east taking you to what you have seen is the slightly less crowded Broad Walk.

going west --> will become previous action

Floyd arrives from the east.

Notice here (with my little debug statements) the “going west” only happens after the display of the room because a “look” is generated when the room is gone to.

Is it possible to put the logic for the player going in rules for “report going” while putting the logic for NPCs going in “report a person going”? According to §12.14 of Writing with Inform, “report a person going” should only fire when the person going is not the player.

I found a solution that basically works for the most part, but doesn’t handle the look situation. Or, rather, there’s one part of it I can’t handle. So basically here’s the code for handling the going situation:

Room description style is a kind of value.
The room description styles are Brief, Verbose and Superbrief.

The current room description style is a room description style that varies.
The current room description style variable translates into I6 as "lookmode".

A room has a number called the visited-count.
The visited-count of a room is usually 0.

The describe room gone into rule is not listed in any rulebook.

A room has some text called the summary description.

Report an actor going:
	let T be the description of the location;
	if the actor is the player:
		if the visited-count of the location is 0:
			now the current room description style is Verbose;
		otherwise if the visited-count of the location is 1:
			if the summary description of the location is not "":
				now the description of the location is the summary description of the location;
			otherwise:
				now the description of the location is "";
		otherwise:
			now the current room description style is Superbrief;
	follow the describe room gone into rule;
	now the current room description style is Verbose;
	now the description of the location is the T;
	if the actor is the player:
		increment the visited-count of the location.

When play begins, increment the visited-count of the location of the player.

That lets me have a room that has a summary description, as such:

Palace Gate is a room. “Palace Gate is a street running north to south leading up to Kensington Gardens. It was previously part of the Gloucester Road, which is just to the south. According to the guidebook, Gloucester Road was named after Maria, Duchess of Gloucester and Edinburgh who apparently built a house there in 1805.[p]A tide of baby strollers [–] or perambulators, as they call them here [–] surges north along what becomes the crowded Broad Walk. Shaded glades stretch away to the northeast and a hint of color marks the western edge of what the guidebook says is the Flower Walk.”

The summary description of Palace Gate is “This is the Palace Gate street, leading into Kensington Gardens, with the north taking you to [summarize the Broad Walk] and east taking you to [summarize the Flower Walk].”

As well as one that does not:

Flower Walk is a room. “Gaily colored flower beds line the walks bending north and west, filling the air with a gentle fragrance. A little path leads northeast, between the trees.[p]The spires of the Albert Memorial are all too visible to the south. Passing tourists hoot with laughter at the dreadful sight; nannies hide their faces and roll quickly away.”

And all of this basically works when you go to the rooms, in the sense of the “description decay” that I mentioned. It seems to be consistent as well since it handles NPCs following the player into rooms as well as handling locales, initial appearance text, etc.

With that logic working as it does, the only remaining part would be for me to try to get the LOOK action to work as follows:

When the player types "LOOK":
    (1) only show the summary description
    (2) if there is no summary description, show the full description

That’s the part that I’m finding is tricky because everything I do to modify how look works interferes with the previous logic since an implicit “look” action occurs when the player goes into a room.

Not to bang the drum, but it seems to me that this is the part where the really looking trick could be useful.

Understand nothing as looking.

Really looking is an action applying to nothing. Understand "look" as really looking.

Carry out really looking:
	if the summary description of the location is not empty:
		say the summary description of the location;
		say line break;
	otherwise:
		say the description of the location;
		say line break.

Entire example:

Room description style is a kind of value.
The room description styles are Brief, Verbose and Superbrief.

The current room description style is a room description style that varies.
The current room description style variable translates into I6 as "lookmode".

A room has a number called the visited-count.
The visited-count of a room is usually 0.

The describe room gone into rule is not listed in any rulebook.

A room has some text called the summary description.

Report an actor going:
	let T be the description of the location;
	if the actor is the player:
		if the visited-count of the location is 0:
			now the current room description style is Verbose;
		otherwise if the visited-count of the location is 1:
			if the summary description of the location is not "":
				now the description of the location is the summary description of the location;
			otherwise:
				now the description of the location is "";
		otherwise:
			now the current room description style is Superbrief;
	follow the describe room gone into rule;
	now the current room description style is Verbose;
	now the description of the location is the T;
	if the actor is the player:
		increment the visited-count of the location.

When play begins, increment the visited-count of the location of the player.



Palace Gate is a room. “Palace Gate is a street running north to south leading up to Kensington Gardens. It was previously part of the Gloucester Road, which is just to the south. According to the guidebook, Gloucester Road was named after Maria, Duchess of Gloucester and Edinburgh who apparently built a house there in 1805.[paragraph break]A tide of baby strollers -- or perambulators, as they call them here -- surges north along what becomes the crowded Broad Walk. Shaded glades stretch away to the northeast and a hint of color marks the western edge of what the guidebook says is the Flower Walk.”

The summary description of Palace Gate is “This is the Palace Gate street, leading into Kensington Gardens, with the north taking you to the Broad Walk and east taking you to the Flower Walk.”


Flower Walk is a room. “Gaily colored flower beds line the walks bending north and west, filling the air with a gentle fragrance. A little path leads northeast, between the trees.[paragraph break]The spires of the Albert Memorial are all too visible to the south. Passing tourists hoot with laughter at the dreadful sight; nannies hide their faces and roll quickly away.”

Flower Walk is east of Palace Gate.

Broad Walk is north of Palace Gate. "Just go back south to Palace Gate, OK?"

Section - Really Looking

Understand nothing as looking.

Really looking is an action applying to nothing. Understand "look" as really looking.

Carry out really looking:
	if the summary description of the location is not empty:
		say the summary description of the location;
		say line break;
	otherwise:
		say the description of the location;
		say line break.

Now, this might get a bit complicated if you want to have the other stuff that comes with looking, like the you-can-also-see rule. One thing you could do is to have really looking set a flag and call the looking action–then have the relevant rule print different things depending on whether or not the flag is set, while leaving all the other rules for looking alone.