Is there a way to define a new relation that relates a thing to a room-or-container, the way “enclosure” and “containment” do?
Relate a thing to an object. (Rooms, things, and containers all descend from the “object” kind.)
Unfortunately Inform won’t allow relations involving “objects”.
Then I guess there isn’t.
You could set up a conditional relation:
[code]Test Chamber is a room. West Chamber is west of Test Chamber.
Exclusion relates an object (called X) to a thing (called Y) when (X is a container or X is a room) and Y is not X and Y is not enclosed by X.
The verb to exclude means the exclusion relation.
A bucket is an open container in Test Chamber.
An apple is in the bucket.
A femur is in Test Chamber.
A lemur is in West Chamber.
Instead of examining something:
say “[The noun] is excluded by [if at least one thing excludes the noun][the list of things that exclude the noun] and [end if][the list of rooms that exclude the noun].”
Test me with “x apple / x bucket / x femur / w / x lemur”.[/code]
You can test for a conditional relationship, but you can’t actively set or break it, so it might not suit your purpose.