I7: Adjective synonyms

Normally, Inform will automatically accept parts of a phrase as synonyms. For instance, if Elvis Presley were in your game, it would accept “Elvis” or “Presley” as synonyms, without needing an “understand” statement.

However, I’ve got a situation where it won’t do the same thing for adjectives: it won’t accept anything except the entire name.

[code]Substance is a kind of value. The substances are ale, ginger ale, and none.

Understand “empty” as none.

A container has a substance. The substance of a container is usually none.

Definition: a container (called the current container) is unfilled rather than filled if the substance of the current container is none.

After printing the name of a container (called the current container):
If the current container is filled:
say " of [substance]".
Understand the substance property as describing a container.
Understand “of” as a container.

Rule for printing room description details of a container:

The Lab is a room.

A bottle is a kind of container.

In the lab is an ginger ale bottle.

Test me with “x ginger ale/x ale/x ginger”.[/code]

An “understand” statement doesn’t help because if you say “understand “ale” as ginger ale,” then it won’t understand “ale” as ale anymore–even if there is no ginger ale present. (You can verify by changing the ginger ale bottle to an ale bottle.)

You could write:

Understand "ginger" as ginger ale. Understand "ale" as ginger ale when the player can see a ginger ale container.

and then it’ll understand “ale” as ale when no ginger ale is present. If both are present, though, it’ll automatically default to understanding “ale” as the bottle of ginger ale even when both are present. You can work around that thus:

Understand "ginger" as ginger ale. Understand "ginger ale" as ginger ale. Understand "ale" as ginger ale when the player can see a ginger ale container and the player cannot see an ale container.

The second line seems to be necessary, or when both are present “x ginger ale” will give you an “I only understood you as far as…” message; it seems that “ginger” gets parsed as ginger ale and “ale” gets parsed as ale.

I’m not sure what the underlying mechanism is here (actually I’m a little surprised that “in the lab is an ginger ale bottle” is producing a bottle whose substance is ginger ale at all). And all this was just tested by dropping the code into your example, so I’m not sure how robust it is. – Oh, and if bottles can be empty you should maybe include a way to refer to them as “empty bottle,” to avoid annoying “Which do you mean, the bottle or the bottle of ale?” loops.

Earlier “understand” statements also keep later ones from functioning (so if you have ginger ale and ginger beer with “understand ‘ginger’” for both, only the first one will be recognized). It appears there’s no way to make a disambiguation message come up; whichever way you handle it, you’re simply establishing a hierarchy of understanding.

(And yes, I have code for empty bottles; I was just keeping the example concise.)