Inform 7 Multiple-Object Disambiguation

I’m having a bit of a problem and will appreciate any help you could offer.

I have a kind called sweet. In a shop I have a container called “bag of sweets” which holds several objects of the sweet kind, and a sweet-dummy scenery object which provides a general description of the sweets in the shop (“All sorts of tempting jars, bags, packets and boxes of sweets lurk temptingly on the shelves behind the counter.”)

What I want to happen is this: when the player is in the shop, “sweets” should refer only to the dummy object, so that when the player types, for instance, “examine sweets”, the game would print the general description (this should also work for other commands, like “take” and “buy”). However, when the player is outside the shop, “sweets” should refer only to the bag.

Is there any way to do this other than intercepting what the player typed (an “after reading a command” rule) and redirecting to the right action?

Thanks in advance.

You can write conditional understanding lines, e.g.:

Understand “sweet”, “sweets” as the bag when the location is not the Shop.

(You might have to rename the bag object, or make it privately-named, to turn off the unconditional application of “sweets” which happens by default.)

Thank you very much! Worked like a charm :smiley: