Thanks wade!
Now I’d like to come back to my original question using your code.
So in your solution some pockets are a kind of container
and pockets are a part of every nightwear
, so we relate the kind (class) pockets to the kind (class) nightwear. When we instantiate the gown
, I7 also creates an instance of pockets
I assume.
So far so good. Now I’ll add @Zed 's code from here, to achieve that the contents of the pockets are shown in the inventory:
Lab is a room.
a carrot is in lab.
a nightwear is a kind of wearable thing.
the gown is a nightwear. player wears the gown.
some pockets are a kind of container.
pockets are a part of every nightwear.
Understand "pocket" as pockets.
Use the serial comma.
Rule for printing inventory details of gown:
say " (the pockets ";
if the first thing held by the pockets is nothing begin;
say "is empty";
else;
say "contain ";
list the contents of the pockets, as a sentence, giving brief inventory information, tersely, not listing concealed items;
end if;
say ")";
Test me with "get carrot/put carrot in pocket/ inventory / x pockets/get carrot".
I7 seems to complain about pockets
not being an object (maybe because in its definition it is actually a kind
? ):
Problem. You wrote 'if the first thing held by the pockets is nothing' , but 'pockets' is used in a context where I'd expect to see a (single) specific example of an object, not a description.
I made it work in the end by defining nightwear-pockets
as kind first, and then creating an instance with some pockets are nightwear-pockets
, but I wonder if there is another way to help I7 understand that in Zed’s rule, we’d like to refer to the instantiated object of pockets
(what would be its name?), not the kind definition. Any ideas?