Tried for 10 min. to come up with a subject. Need to sleep.

[code]
A cabinet is a kind of supporter. A cabinet is usually fixed in place.
A drawer is a kind of container. A drawer is always openable. A drawer is usually closed. Instead of searching a closed drawer, try opening the noun.

An upper drawer is a kind of drawer. An upper drawer is part of every cabinet.
A lower drawer is a kind of drawer. A lower drawer is part of every cabinet.

Instead of opening the closed lower drawer when the upper drawer is open, say “The upper drawer is in the way.”
Instead of examining the open lower drawer when the upper drawer is open, say “The upper drawer is in the way.”
Instead of taking something inside the open lower drawer when the upper drawer is open, say “You have to close the upper drawer first.”
Instead of examining something inside the open lower drawer when the upper drawer is open, say “You need to close the upper drawer first.”

room1 is a room. room2 is a room.
cabinet1 is in room1. cabinet1 is a cabinet. Inside cabinet1’s upper drawer is a fish.
cabinet2 is in room2. cabinet2 is a cabinet. Inside cabinet2’s lower drawer is a ghoti.[/code]

Now the problem is if I go to room1, open cabinet1’s upper drawer, then go to room2 and try to open cabinet2’s lower drawer, I get the “The upper drawer is in the way.” failure.

I need somehow to have the drawers get unique names for every cabinet. I’ve also tried to write something like this:
Instead of opening the closed lower drawer when the parent’s (or cabinet’s) upper drawer is open, say “The upper drawer is in the way.”

Thanks in advance for any help. Many thanks for a solution.

You have very clean code. I’d say the root cause error here is that Inform doesn’t follow English conventions perfectly: we expect “the [x]” to mean “the specific example of [x] that I’m referring to”, but Inform simply thinks that you’re referring to the kind itself, meaning that your phrase matches all cabinets.

Inform allows us to do something like this, of course:

Check opening the closed lower drawer (this is the annoyingly wordy drawer rule): if the noun is part of a cabinet: let x be a random thing incorporating the noun; if x incorporates a closed upper drawer: say "The upper drawer is in the way." instead.

I’d rather not do that: your code is clean and that should be retained, so I decided to just add some syntactic sugar. Since we can already refer to the holder of something in Inform, referring to the “base of [x]” seems natural to me, so I made a quick decide phrase to extend the syntax (the phrase needs to return an object rather than a thing because “nothing” is an “object” rather than a “thing”).

To decide which object is the base of (item - a thing): if the item is part of something (called the parent), decide on the parent; decide on nothing.

That lets us be at least a little more concise, although Inform still needs us to spell it out a bit:

Instead of opening a lower drawer when the base of the noun incorporates an open upper drawer: say "The upper drawer is in the way." Instead of taking or examining something inside the open lower drawer when the base of the holder of the noun incorporates an open upper drawer: say "You need to close the upper drawer first."

A couple of the lesser-known phrases from the Standard Rules are as if made for this occasion: viz. 'component parts core of ’ and ‘not-counting-parts holder of’:

[code]Instead of opening a lower drawer when the component parts core of the noun incorporates an open upper drawer:
say “The upper drawer is in the way.”

Instead of taking or examining something inside the open lower drawer when the not-counting-parts holder of the noun incorporates an open upper drawer:
say “You need to close the upper drawer first.”[/code]
(The difference between the base of something as defined by Björn and a component parts core of it, is that if a thing is part of something that is itself part of something that is itself part of … &c, then the component parts core is the last thing in that chain (i.e. the thing that is not itself a part of anything else).)

Nice. I’d endorse this before my own solution, unless of course the drawers themselves had attached incorporated items.

Tusen takk!

You might also want to consider using Automated Drawers by Emily Short, which pretty much does the whole lot and more.

Hope this helps.