[I7 extension] Enterable Underside (first version)

A prototype of an extension (with an example) which extends Underside by Eric Eve to allow actors to hide under objects.

Enterable Underside by Eric Conrad begins here.

"Extends Eric Eve's Underside extension by providing a means for hiding the player or a non-player character underneath an object in play.  (Requires version 6 of Underside by Eric Eve, which is included here."

"thanks to Gavin Lambert for a number of suggestions"

Include Underside by Eric Eve.

Part 1 - The Underside Kind

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

Part 2 - Looking Under

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

Part 3 -  The Hiding Under Action

Chapter 3a -  Action definition

Hiding under is an action applying to one visible thing.

The specification of the hiding under action is "This is the action which allows a player or other character to enter the underside of something.".

Understand "hide under [something]" as hiding under.  Understand "hide underneath [something]" as hiding under.

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

Setting action variables for hiding under something:
	Now the ud-side is a random underside that is part of the noun.

Chapter 3b - Before Rules and Preconditions

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

Chapter 3c - Check Rules

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

Check an actor hiding under something (this is the enterability check for hiding under rule):
	if ud-side is not enterable, say "It is not possible to hide under [the noun]." (A) instead.

Chapter 3d - Carry Out Rules

Carry out an actor hiding under something (this is the usual hiding under rule):
	move the actor to the ud-side;
	now the ud-side is open.

Chapter 3e - Report Rules

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

Part 4 - Addenda

	[ There are certainly other things that need to be checked. ]

Part 5 - Conclusion

Enterable Underside ends here.


Chapter: Enterable Underside

Section: The Basics

The Enterable Underside extension allows the player or non-player characters to hide underneath things which incorporate an underside.  This extension requires Eric Eve's Underside extension, version 6 or later.

To use the  Enterable Underside extension, we need an object which has an enterable underside.  By default, an underside is dark -- if there is an ambient light source it should be declared transparent  We might define:

	The bed is an enterable supporter.

	The under#bed is an underside.  It is part of the bed.  It is enterable and transparent.

To get under the bed, we use the command HIDE UNDER BED.

Example: * The Sweet Life - The husband comes home at an awkward moment.

	*: "The Sweet Life"

	Include Enterable Underside by Eric Conrad.

	The bedroom is a room.

	The bed is an enterable supporter.  It is in the bedroom.  The player is on the bed.  Angelina is a woman on the bed.

		[ Enterable allows the player to enter.  Transparent is needed so the player can see. ]

	The under#bed is an underside.  It is part of the bed.  It is enterable and transparent.

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

	After looking under the bed:
		say "'Angelina?  How could you -- with Roberto?'".

		[ Two normal people can just fit under the bed provided there is nothing else there. ]

	The bulk of a person is usually 5.

	When play begins:
		now the story viewpoint is first person singular;
		say "[italic type](Dedicated to those dubbed Italian comedies from the early 1970s)[roman type][paragraph break]The door to the apartment slams shut.  From the hallway, the voice calls out 'Mi amore, I'm home.'  Panic-stricken, Angelina looks at me and whispers 'It's Giovanni.  Quickly, you must hide!'  Giovanni's steps grow softer as he walks toward the kitchen.  She breathes a sigh of relief as we hear the refrigerator open.  'Now hide.'  She points down, under the bed.".

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

	When arrival begins:
		say "As Giovanni enters the bedroom, he says, 'Mia cara!  It's so fine to be home.'  Angelina answers, 'O Giovanni, I missed you so.  Please buy some wine to celebrate!'[paragraph break]As her husband leaves for the store, she says, 'Both of you, out!'";
		try Roberto exiting.

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

Oh hey, you beat me to it. I haven’t had time to look at your version yet, but I made a version of this too – you can have a look through or play with it here.

(It also needs this.)

1 Like

Re: Gavin’s reply above

Looks very good. It deals with looking while underneath the bed and corrects the response when exiting from underneath. (Although I noticed those issues, I hadn’t dealt with them.)

(If anyone else wants to try Gavin’s extension, note that you’ll need to install both his version of Enterable Underside and his extension Prepositional Correctness. Links to both, on GitHub, are in his post. Download the Raw versions.)

I’ve updated it to steal your example, and include a demonstration of something that doesn’t work properly. (@matt_weiner this is another example of CoreOfParentOfCoreOf being weird, but I’m not sure what a good fix would be.)

Not sure what else might need tweaking.

1 Like

I’ve just pushed version 2 of both extensions.

Prepositional Correctness version 2 is a total rewrite that extends it to almost the entire Standard Library, so you can now be more consistent with your custom prepositions. It also does some highly fancy adaptive verb stuff that I’m kinda proud of. :smile:

Enterable Underside version 2 has a smaller update to take advantage of this, but as a result it also fixes the known bugs with other containers/supporters in the underside (and actually has a working container-part-of-container setup now… although it wouldn’t surprise me if there were still a few lingering issues I haven’t noticed yet).

1 Like


It looks like this small exercise managed to provide a workaround for bugs in the mechanics underlying supporters/containers/parts.

Is there an example or two from the discussion under “CoreOfParentOfCoreOf being weird” that you might want to include in the Prepositional Correctness examples?

No, it’s not fixed in general (and not by Prepositional Correctness, it just helped with a related display issue). It still requires a custom exit rule to work around each case individually. (In this case, one that knows that undersides are parts of other things.)

1 Like

One more slight tweak today. It turns out that if you say:

say text of implicitly pass through other barriers rule response (A);

And this response includes a local variable, it uses some memory location other than the local variable of the same name in the calling rule, which will usually have the wrong value. (But did occasionally have the right value, which is why I initially thought it was working.)

I was hoping to use this to avoid duplicating the text of the response and keeping it replaceable under the same name as before, but I guess Inform doesn’t support that properly.

The difficulty seems to be in the handling of named responses which are defined inside loops.

In my copy of the Standard Rules, the rule in question is a Check an actor entering rule on line 2519, and response (A) uses a variable current home which is set with each in the first line inside a while loop. Now consider the following simple story:

"testing" by Eric Conrad

Fooing is an action applying to one thing.  Understand "foo [container]" as fooing.

Check fooing:
	if the noun is not a container, say "Oops!".

Report fooing a container (this is the report fooing rule):
	let baz be "foo";
	repeat with x running through the list of things in the noun:
		say "[baz] [x]." (A).

Barring is an action applying to one thing.  Understand "bar [supporter]" as barring.

Check barring:
	if the noun is not a supporter, say "Eek!".

Report barring a supporter (this is the report barring rule):
	let baz be "bar";
	repeat with x running through the list of things on the noun:
		say text of the report fooing rule response (A).

Start is a room.

The jar is a container.  It is in Start.  The pickle is in the jar.  The vinegar is in the jar.

The shelf is a supporter.  It is in Start.  The kitten is on the shelf.  The baby is on the shelf.

Test me with "foo jar / bar shelf"

The response to the command foo jar is, as expected:

foo pickle.
foo vinegar.

By analogy, the expected response to bar shelf would seem to be:

bar kitten.
bar baby.

But analogy fails and the actual response in Inform 7 v6M62 is:


(Yes, just one line!) Curiously, if the response is not inside a repeat loop, the actual behaviour and the expected behaviour are in agreement.

Yeah, it’s weird, I’m not quite sure exactly what quirk of the compiler produces this behaviour. It gave me a Runtime Problem on occasion as well, though not consistently.

But I guess it doesn’t really matter, the new version works ok. And looks slightly better in the Index, too.