Containers (again)

Hi all,
simple question: How do I create a container (a cupboard) that’s not listed in the room desciption but can be examined, and that contains stuff, and that described depending onm being open or closed, like this:
X CUPBOARD
A wooden cupboard. It is closed.
OPEN CUPBOARD
You open the cupboard, revealing a thing and a thong.
EXAMINE CUPBOARD
A wooden cupboard. It contains a thing and a thong.

(I got the “It is closed.” and the “revealing a thing and a thong” thing, but examining my open cupboard just results in “A wooden cupboard.”.)

Thanks and kind regards,
Grues

2 Likes

If you don’t want an object to be listed in the room description and the object is a permanent part of the room you want Fixture.

Containers in general get Container and if you want to open and close the container you want an OpenableContainer.

So, put together, you want a Fixture, OpenableContainer, like:

#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>

startRoom: Room 'Void'
        "This is a featureless void with a built-in cupboard. ";
+cupboard: Fixture, OpenableContainer '(wooden) cupboard' 'cupboard'
        "A wooden cupboard. "
;
++pebble: Thing 'small round pebble' 'pebble' "A small, round pebble. ";
+me: Person;

versionInfo: GameID;
gameMain: GameMainDef initialPlayerChar = me;

This gets us:

Void
This is a featureless void with a built-in cupboard.

>x cupboard
A wooden cupboard.  It's closed.

>open cupboard
Opening the cupboard reveals a pebble.

>x cupboard
A wooden cupboard.  It's open, and contains a pebble.
4 Likes