This has been bugging me for a while and I just can’t get it to go away. I have a trunk that the player can also stand on, i.e. a container-supporter, which may be a fool’s errand, I don’t know. The whole source is a little long, so I’m collapsing it and providing what I think is the relevant part below.
Lab is a room.
The black trunk is a supporter. It is enterable. It is in Lab. It is portable. The description is "This is a large, plain black trunk with steel trim. It latches shut, but doesn't have a locking mechanism.". [The mass is 3. ]Understand "chest" as the black trunk.
The black trunk's inside is a container. It is privately-named. The printed name is "black trunk". It is part of the black trunk. It is openable and closed. The description is "This is a large, plain black trunk with steel trim. It latches shut, but doesn't have a locking mechanism.".
The black trunk's inside contains a doll.
The player carries a flute and a rubber ball.
Before entering the black trunk:
if the black trunk's inside is open:
say "(first closing the black trunk)[command clarification break]";
silently try closing the black trunk's inside;
continue the action.
Rule for listing contents of the black trunk:
if something is on the black trunk:
continue the activity;
otherwise:
carry out the listing contents activity with the black trunk's inside;
To write after entry for (O - object):
(- WriteAfterEntry( {O} ); -).
To write after entry for (O - object) with depth (D - a number):
(- WriteAfterEntry( {O}, {D} ); -).
Rule for printing room description details for the black trunk when nothing is on the black trunk:
write after entry for the black trunk's inside.
Rule for printing inventory details for the black trunk:
if black trunk's inside is closed:
say " (closed)";
otherwise if black trunk's inside is open and black trunk's inside contains nothing:
say " (open but empty)";
otherwise:
write after entry for the black trunk's inside with depth 0;
Understand "black" and "trunk" as the black trunk's inside.
Does the player mean removing from the black trunk when the black trunk's inside is open:
It is very unlikely.
Does the player mean removing from the black trunk when the black trunk's inside is closed:
It is very likely.
Rule for clarifying the parser's choice of the black trunk: do nothing.
Rule for clarifying the parser's choice of the black trunk's inside: do nothing.
Before taking the black trunk when something is on the trunk and the player is not on the trunk:
say "(first taking [the list of things that are on the black trunk])[command clarification break]";
Repeat with X running through the list of things that are on the black trunk:
silently try taking X;
continue the action;
Instead of opening the black trunk when the player is on the black trunk:
say "You'll have to get off the black trunk first.";
Instead of opening the black trunk when something (called T) is on the black trunk and T is not the player:
say "(first taking [the list of things that are on the black trunk])[command clarification break]";
Repeat with X running through the list of things that are on the black trunk:
silently try taking X;
continue the action;
Instead of opening the black trunk:
try opening the black trunk's inside;
Instead of closing the black trunk:
try closing the black trunk's inside;
Instead of inserting a thing (called T) into the black trunk:
try inserting T into the black trunk's inside;
Instead of putting something (called T) on the black trunk when the black trunk's inside is open:
if T is enclosed by the trunk:
carry out the implicitly taking activity with the noun;
say "(first closing the black trunk)[command clarification break]";
silently try closing the black trunk's inside;
continue the action;
Instead of examining the black trunk:
if something is on the black trunk:
continue the action;
otherwise:
try examining the black trunk's inside;
Instead of searching the black trunk:
if something is on the black trunk:
continue the action;
otherwise:
try searching the black trunk's inside;
Lab is a room.
The black trunk is a supporter. It is enterable. It is in Lab. It is portable. The description is "This is a large, plain black trunk with steel trim. It latches shut, but doesn't have a locking mechanism.". [The mass is 3. ]Understand "chest" as the black trunk.
The black trunk's inside is a container. It is privately-named. The printed name is "black trunk". It is part of the black trunk. It is openable and closed. The description is "This is a large, plain black trunk with steel trim. It latches shut, but doesn't have a locking mechanism.".
The black trunk's inside contains a doll.
The player carries a flute and a rubber ball.
Before entering the black trunk:
if the black trunk's inside is open:
say "(first closing the black trunk)[command clarification break]";
silently try closing the black trunk's inside;
continue the action.
Rule for listing contents of the black trunk:
if something is on the black trunk:
continue the activity;
otherwise:
carry out the listing contents activity with the black trunk's inside;
To write after entry for (O - object):
(- WriteAfterEntry( {O} ); -).
Rule for printing room description details for the black trunk when nothing is on the black trunk:
write after entry for the black trunk's inside.
Rule for printing inventory details for the black trunk:
if black trunk's inside is closed:
say " (closed)";
otherwise if black trunk's inside is open and black trunk's inside contains nothing:
say " (open but empty)";
otherwise:
write after entry for the black trunk's inside;
Instead of opening the black trunk:
try opening the black trunk's inside;
Instead of closing the black trunk:
try closing the black trunk's inside;
The issue is how inventory is formatted:
Lab
You can see a black trunk (closed) here.
>take trunk
Taken.
>i
You are carrying:
a black trunk (closed)
a flute
a rubber ball
>open it
You open the black trunk, revealing a doll.
>i
You are carrying:
a black trunk (open)
a doll
a flute
a rubber ball
>
I’m not at all clear what I can do about the blank line between the trunk contents and the flute listing. Any ideas?
In a related question: is there a decent container-supporter implementation in an extension or otherwise, anywhere? So far I haven’t had any luck on either Google or the intfiction search.