The Underside extension and carrying capacity

The very nice Underside extension (as in: Include Underside by Eric Eve) defines an underside as a type of container, but ignores carrying capacity. It is easy to enforce the condition, but sometimes hard to set the condition.

If (for example) mom doesn’t want you (the player) to put more than n things under the bed, add the following rule:

Check placing something under (this is the underside capacity exceeded rule):
	if the second noun incorporates an underside (called x):
		let c be the carrying capacity of x;
		let n be the number of things in x;
		if n is not less than c, say "There are already too many things under [the second noun]." instead.

(To force others to observe capacities, add the actor between Check and placing.)

For reasons that I don’t fully understand, in Inform 7 it can sometimes be ridiculously easy and at other times painfully hard to set an initial state for parts a thing. (The problem seems to be some ambiguities that are inherent in English grammar.) Difficulty seems to vary according to whether the part is described as part of a kind (class) or part of a thing (instance), and apparently also, whether the thing or the part is named with a single word or more than one word. The only workaround that consistently works seems to be when play or some other scene begins, for example:

When play begins:
          [ Mom doesn't allow anything under the bed! ]
    if the small bed incorporates an underside (called x):
       now the carrying capacity of x is 0;
          [ The banjo picker doesn't care what Mom doesn't allow! ]
       now the banjo picker is under the bed.
1 Like

The Underside extension uses the Bulk Limiter extension, and it expects you to use that to limit what you can put under things based on size rather than quantity. (This makes a certain amount of sense – some things are too large to fit under a bed at all, while you might be able to squeeze more small things in than larger things.)

For example:

Include Underside by Eric Eve.

A pillow is a kind of thing.  The bulk of a pillow is usually 2.
Bedroom is a room.  It contains a small bed and 5 pillows.
An underside called under#bed is part of the bed.  The bulk capacity is 5.

Test me with "put pillow under bed / g / g".

(The default bulk capacity of a container is 10, and the default bulk of a thing is 1, so if you don’t specify those values differently then it would have let you put 10 pillows under the bed, but no more.)

1 Like :Underside extension uses the Bulk Limiter extension

It took a little while to find, but the documentation mentions this:

Underside includes Bulk Limiter, and enforces checks that the total bulk of objects placed under something does not exceed the bulk capacity of its underside. It is compatible with Implicit Actions, insofar as it will use Implicit Actions to generate an implicit take command for PUT X UNDER Y when X is not carried, but it can also be used without Implicit Actions, in which case it will use its own code to perform an implicit take.

FYI/Addendum: here is a little script involving an enterable underside that I created using Gavin’s hints. A few observations: (1) an underside is dark - when entered, if there is ambient light, that must be indicated (e.g. as transparent) or provided in some way; (2) an action must be provided to enable entry under; (3) scenery is visible in an underside when looking under, and (4) the room description rules and the looking rules must be extended a bit to incorporate a view from the underside. I haven’t done (4) – and I don’t know whether there is already an enterable undersides extension.

"Scene from an Italian movie, circa 1970" by Eric Conrad

Include Underside by Eric Eve.

The bulk of a person is usually 5.

The bedroom is a room.  The bed is a supporter in the bedroom.  It is enterable.  The under#bed is an underside.  It is part of the bed.  It is enterable and open.  It is transparent.

[ The poplight is a thing.  It is in the under#bed.  It is scenery.  It is lit.  The bulk of the poplight is 0. ]

The shoebox is a container.  It is in the under#bed.

Roberto is a person in the bedroom.

Angelina is a woman on the bed.  The player is on the bed.

Hiding under is an action applying to one visible thing.  Understand "hide under [something]" as hiding under.

	(This doesn't seem to work...)
Setting action variables for hiding under something:
	Now the u-side is a random underside that is part of the noun.

Before an actor hiding under something (this is the before hiding under rule):
	let the u-side be a random underside that is part of the noun;
	if the u-side is nothing,  say "[We] [can't] put anything under [the second noun]." (A) instead;
	if the actor is in the u-side, say "[The actor] [are] already under [the noun]." (B) instead.

Check an actor hiding under something (this is the check hiding under rule):
	let the u-side be a random underside that is part of the noun;
	if u-side is an underside and u-side provides the property bulk capacity:
		if the bulk of the actor > the bulk capacity of u-side, say "[The actor] [are] too big to fit under [the noun]." (A) instead;
		if the bulk of the actor > the free capacity of u-side, say "[There] [are not] enough room left under [the noun]." (B) instead.

Carry out an actor hiding under something (this is the standard hide under rule):
	let the u-side be a random underside that is part of the noun;
	move the actor to the u-side.

Report an actor hiding under something (this is the standard report hide under rule):
	say "Done." (A).

After looking under the bed:
	say " -- Sergio (il protagonista/the protagonist): 'Adultera!  Vedo Roberto!'  (Yellow subtitle: 'Adulteress!  I see Roberto!'".

When play begins:
	try silently Roberto hiding under the bed;
	say "(Apologies for the sloppy Italian!)[paragraph break]An outside door slams shut and the husband calls out.  'Cara, sono a casa!'  (Yellow subtitle: 'Honey, I'm home!' / The inferior dubbed version has: 'Honey, I'ma home.')[paragraph break]Angelina gives you a panic-stricken look.".

Arrival is a scene.  Arrival begins when the player is in the under#bed.

When arrival begins:
	say " -- Il marito/the husband: 'O la mia!  Mia cara!' (Yellow subtitle: 'O my dear!')"

Test me with "look under bed / hide under bed / take shoebox / hide under bed".

Difficulty (4) shows up in the transcript (NB: the preposition on):

>[4] hide under bed
bedroom (on the bed)
On the bed you can see Angelina.


Underside wasn’t really written to expect that the underside would be made enterable by the player. I don’t think there are any other extensions that support this out of the box.

But, to address some of your issues:

I’m not sure if this is the best way to do it, but you can fix scenery things being listed under the bed by adding this:

The clever looking under rule response (A) is "Under [the noun] [is-are a list of locale-supportable things in the underpart]."

To get the setting action variables rule to work, you first also must say this:

The hiding under action has an object called the ud-side.

Then remove your let lines and change u-side in the other lines to ud-side instead. I’m not entirely sure why it won’t let you use the same name as another action (that may be a bug), but this works around it.

Also your Before rule should be another Check rule, to allow story-specific Before rules to properly override it.

Getting the correct preposition in the look description can be done like so:

The room description heading rule response (B) is " ([if the player is under the intermediate level]under[otherwise]on[end if] [the intermediate level])".

Preventing seeing or otherwise interacting with what’s on top of the bed while under it is a more difficult problem (though it can be done!). It might be simplest to handwave that.

1 Like

Using your latest hints and suggestions, and, as a beginning, my silly story based on Italian sex comedies from the early 1970s, it might be fairly easy to write an Enterable Undersides extension of the Undersides extension, or at least a good working prototype of such.

It is not unusual for a protagonist to hide under a bed or whatever to temporarily escape from villains (at minimum pretty common in classic Doctor Who), and a villain might do the same to surprise the protagonist… I’ll grant that it’s a trite plot device, but it’s one that I rather enjoy…


Sure. I might take a crack at that later, unless you wanted to yourself.

(Incidentally, I fixed a typo with the declaration of the action variable.)

1 Like

I was thinking of giving it a try, but I’m not averse to either collaboration or competition.