Containers and supporters conundum


Is it possible to have a thing that is both a container and a supporter? For example you can get into a bed as well as lie on it and indeed sit on it.

Also supposing you have an open topped crate, this is obviously a container, but suppose you turn it upside down? Now it becomes a supporter - you cant put stuff in it but you can put stuff on it.

One of my puzzles involves such a crate. The player can hide in it, or turn it over and use it to stand on to reach something. Or they would if I had any idea how to do this! I thought Supplimentry Actions by Al Golden might be my saviour, but version 30 is erroring out as follows;

I have a feeling I am going to have to add something to the thing definition as well as modify a lot of commands - ugh. Anyone know of a good place to start?

No, I7 things can’t be both containers and supporters. In some cases (like the bed) a workable solution is to make a supporter object part of a container object (or vice versa). In other cases (like the upside down crate) it might be better to silently switch a container for a supporter (and vice versa).

This is a pretty common question. The short answer is: no, something can’t inherit from two kinds. What you can do, however, is make a part of a container that’s also a supporter. The example U-Stor-It should cover everything you need.

Supplementary Actions is, frankly, not a very robust or useful extension.

Many thanks for the replies, I quite like the idea of swapping a container for a supporter but am unclear how to go about this. Will I need 2 definitions for the item, or can you change them on the fly? I will also need some way of remembering any items that are put in the chest before it is inverted but again am too new at inform to know how to start.

You need to define two distinct objects. Things that currently are in no room are “off-stage”, waiting in the wings, as it were. If you move a container off-stage, its contents goes with it. Something like this, perhaps:

The Place is a room.
Another Place is north of the Place.

The crate is a container in Place.
The upside down crate is an enterable portable supporter. [Don't tell Inform where a thing is, and it starts out off-stage.]
The shelf is a supporter in Another Place.
A very desirable thing is on the shelf.

Instead of taking anything on the shelf when the player is not on the upside down crate: say "You don't reach up to the shelf."

After dropping the crate in Another Place:
	now the crate is off-stage;
	say "You put the crate on the floor, upside down.";
	now the upside down crate is in the location;
	set pronouns from the upside down crate.

After taking the upside down crate:
	now the upside down crate is off-stage;
	now the player carries the crate;
	set pronouns from the crate;
	continue the action.
Instead of climbing an enterable supporter: try entering the noun.
Instead of going down when the player is on a supporter: try exiting.
Instead of inserting something into the upside down crate: say "You can't put anything in the crate as long as it's upside down."