i7: Description of items in containers?

When walking into a room all object “descriptions” are shown to the player. How can I make it behave the same when looking inside a container that holds object x? When opening the container with x it just says “In the container there is a letter.”

[code]>look at container
It gives an impression of being important due to it having worn the sigill. Rumor has it only the emperor, his nearest of kin and a few selected advisors are authorised to use it. The container is of good craftmanship. It has a cylindrical shape made of just a single piece of leather to better protect its content in case it would be exposed to water.

In the scroll container is a letter.[/code]

How do I get inform7 to replace the bolded text above with something more interesting to the player, like a nice description of how the letter is waiting there, resting and just longing for it to be read?

There may be an easier way to do this, but you could try this (I’ve used different objects, but you should be able to adapt it OK):

[code]The chest is a container in Ledges. A pile of gold is in chest. A rock is in chest.

Rule for printing room description details of chest when we have not examined the chest: omit contents in listing.

Carry out examining the chest for the first time:
if the gold is in the chest:
say “A pile of gold lies in the chest.”;
if a thing that is not the pile of gold is in the chest:
say “The chest also contains [list of (things that are not the pile of gold) in the chest with indefinite articles].”;
rule succeeds.

The “omit contents in listing” rule stops the game from printing the parenthesised part of “You can also see a chest (in which is a pile of gold and a rock) here” in the room description; if you want that, you can suppress that line. After examining the chest it will print that when you look; you can delete “when we have not examined the chest” if you don’t want it printed ever.

The “examine for the first time” rule prints the special text about the gold if the gold is still in the chest, but there are special cases for when the gold isn’t in the chest or something else is, in case some savvy player has started messing around with it before examining it. "

“Rule succeeds” means that the rest of the carry out examining rules won’t fire, in particular not the standard rule that prints the contents of the container. (And it means that Inform processes the examine action as having succeeded, I think.) After the first examination of the chest, this rule gets skipped, and it goes on to the standard “examine containers rule” that tells you what’s in the chest, “In the chest is a pile of gold and a rock” or what have you.

By the way, the things that get printed when you walk into a room are object initial appearances, not descriptions; the descriptions are what’s printed when you examine an object. Also, I think “sigil” has one L.

Another way to go about it – and that may be useful at times is this:

Rule for printing the name of the letter while (we are examining the scroll container or we are searching the scroll container) and we have not examined the letter and the letter is in the scroll container: say "letter, waiting there, resting in its case, just longing to be read - by you".