Changing the appearance of a 'closed' container

Hello everyone. Is there is a rule, or other piece of code, to alter the default output I describe below?

When a Player enters a room in which they have previously dug and filled a small hole, the game reports this:

You can see a small hole in the ground (closed) here.

When the container is a hole, and the hole is closed, I would like the player to see this instead:

You can see a small hole in the ground (filled) here.

All other containers in the game should continue to report as “closed,” so it’s important not to change the default Inform reporting of ALL containers in the game; just the small holes (a kind of cavity).

A little bit of sample code for some background:

A cavity is a kind of container. 
A cavity is always fixed in place. 
A cavity is usually open.

A small hole is a kind of cavity.
A small hole is openable.

Check Closing a small hole:
	Let H be a random small hole in the location of the Player;
	If H is closed:
		Say "You already filled this hole.";
		Rule Fails;
		If the Player does not carry the handheld shovel:
			Say "You aren't holding anything with which to fill the small hole.";
			Rule Fails;
			Say "You fill the small hole, using the handheld shovel.";
			Now H is closed;
			Rule Succeeds.
1 Like

Does this work?

rule for printing the name of a small hole (called the foo) when the foo is closed:
	say "[printed name of foo] (filled)";
	omit contents in listing.

Solved! Thank you, Mike!

An alternative method would be:

Rule for printing room description details of a closed small hole:
	say " (filled)".

Cf. 18.16. Printing room description details of something

Incidental remark: the hole will still be mentioned as being “closed” instead of “filled” if the player looks into it or (equivalently) searches it when it’s closed:

You can’t see inside, since the hole is closed.

To take care of that, you could add:

Check searching a closed small hole:
	say "The hole is filled up, so there's nothing to see, really. In fact, you begin to have metaphysical doubts about the existence of a hole that's filled." instead;

Went with this:

Rule for printing the name of a small hole (called H) when H is closed:
	Say "filled hole";
	omit contents in listing.

Check Examining a small hole (called H):
	If H is closed:
		Say "You dug a hole here, but you have since filled it in.";
		Rule Succeeds;
		Continue the Action.
Check Searching a small hole (called H):
	Try Examining H;
	Rule Succeeds.

Which outputs this:

Front Yard
You are standing in a meadow, beneath a bright blue sky.

A humble cottage waits to the north, while footpaths trail off to the east, west, and northwest through flourishing wildflowers and switchgrass.

You can see a filled hole here.

x hole
You dug a hole here, but you have since filled it in.

search hole
You dug a hole here, but you have since filled it in

1 Like