Enterable, movable, container/supporter in PunyInform

Here’s a challenge for all you Inform 6 gurus.

I have a crate. I can stand on the crate, so it needs to be an enterable supporter. I can put things in the crate, so it needs to be a container. I can carry the crate, so it can’t be static. How do I implement this in Inform 6, but specifically PunyInform?

I know that an object cannot be both a container and a supporter. The normal way to handle this is to have one object that is a container and another object that is a supporter (or vice versa?) and the second object is added to scope by the first object. The first object’s before and after routines divert the actions to the second object as appropriate.

I have done similar things in the past, but not quite what I need here. I have implemented an openable coal bin (based on an old raif listing), but this cannot be moved. I have also implemented the sterilising machine from exercise 103 of DM4, but this cannot be entered or moved.

What’s the trick to implementing a container/supporter that is both enterable and moveable?

I think I might have solved it. I had the first object (the crate) as a container and the second object (top of crate) as a supporter. If I swap those about and change the action diversions, I think everything will work properly. So the first object (the crate) is the supporter and the second object (inside of crate) is the container.

You can change the attributes of the object during gameplay.

Make an off-scene object to hold the contents of the crate when it’s closed. When the player closes the crate, move the contents away, give it supporter and ~container.

This particular crate is not openable, but your suggestion still applies. I’ve got the supporter part working nicely, but I’m getting a stack overflow with Insert. I must have done something wrong with the diversion of the Insert action, or maybe the Receive fake action. With a bit more trial and error, I’ll (hopefully) work it out.

Edit: I’ve got it working now. I just need to do some more testing to make sure it’s robust.


Generally I create a part object for this case (e.g. desk and drawer), but I never implemented a movable one… how you handle the “movable” part ?

Best rregards from Italy,
dott. Piergiorgio.

As with any moveable object. In this case, the parent object does not have the scenery or static attributes. By “moveable”, I mean it can be carried around.