Defining the relation "vertical arrangement"

Furniture is usually portable.

or, more generally:

A supporter is usually portable.

But… is it? Do you expect someone to pick up a dining room table or a bed and walk around with it?

Here’s a snippet from an earlier example that I posted in this thread:

[May need to relax this for pushing furniture around]
To move is a verb.
Check pushing a fixed in place thing under (this is the can't push fixed in place things under rule):
	instead say "[We] [can't move] [the noun]." (A).

Note the comment. The only reason that there’s a problem pushing fixed in place things under is because we chose to disallow it. We could just as easily allow it.

(If we did allow it, we’d want to distinguish between furniture and other things, like the walls or the window, that really can’t be pushed under.)

Ok, I think I’ve now had enough coffee to look at this.

A thing can be uberistic. A thing is usually not uberistic.

A thing has a number called coverage capacity. The coverage capacity of a thing is usually 0.

When play begins:
	repeat with U running through uberistic things:
		now the coverage capacity of U is 999.

Note that this definition of uberistic (as a property that, when set, maxes out coverage capacity) conflicts with the one from the earlier example where we defined it as an adjective that allowed us to refer to things with nonzero coverage capacity.

A better approach might be to add this definition:

Definition: a thing is uberfull if it is not uberistic and the number of things under it >= its coverage capacity.

and then to never refer to coverage capacity directly in other rules, but only check whether things are uberfull or not.

See the shared rulebook example here: Defining the relation "vertical arrangement".

You’ll want to share a lot of the check rules between your pushing it under and putting it under actions.

If, after giving it a shot, you need more specific help, post your complete code (inside rant tags if it’s very long (he said hypocritically)) and ask some specific questions.

Instead of putting something under an uberfull thing when a supporter is under the second noun:
	let S be a random supporter that is under the second noun;
	say "(putting [the noun] on [the S], because there are already too many things under [the second noun])[command clarification break]";
	try putting the noun on S.
Instead of standing under an uberfull thing when an enterable supporter is under the second noun:
	let ES be a random enterable supporter that is under the second noun;
	say "(getting onto [the ES], because there are already too many things under [the second noun])[command clarification break]";
	try entering ES.
After putting something on a sub supporter:
	now the noun is under the uber of the second noun;
	continue the action.

The existing code for taking will handle clearing the uber when the object is removed from the supporter.

Note that, now that we’re setting the under relation for things that are indirectly under other things, some of the examine output that we worked up earlier in the thread might need to be revisited since it may be clogged up with nested things.

After entering a sub supporter:
	now the player is under the uber of the noun;
	continue the action.

After exiting from a sub supporter:
	if the player is sub, now the player is not under the uber of the player;
	if the holder of the player is sub, now the player is under the uber of the holder of the player;
	continue the action.
Carry out looking (this is the uber room description heading rule):
	say bold type;
	if the visibility level count is 0:
		begin the printing the name of a dark room activity;
		if handling the printing the name of a dark room activity:
			say "Darkness" (A);
		end the printing the name of a dark room activity;
	otherwise if the visibility ceiling is the location:
		say "[visibility ceiling]";
	otherwise:
		say "[The visibility ceiling]";
	say roman type;
	let intermediate level be the visibility-holder of the actor;
	repeat with intermediate level count running from 2 to the visibility level count:
		if the intermediate level is a supporter or the intermediate level is an animal:
			say " (on [the intermediate level])" (B);
		otherwise:
			say " (in [the intermediate level])" (C);
		let the intermediate level be the visibility-holder of the intermediate level;
	if the player is sub and the uber of the player is visible:
		say " (under [the uber of the player])" (D);
	say line break;
	say run paragraph on with special look spacing.
	
The uber room description heading rule is listed instead of the room description heading rule in the carry out looking rulebook.

This adds (under the [uber]) in its own set of parentheses, because there might be multiple levels of containment (e.g., (on the chair) (in the cage) (on the platform)), and it seemed both more consistent and less of a pain to implement.

Definition: a thing is nonplayer if it is not the player.

After examining a super thing:
	say "Underneath [the noun] [if the player is under the noun]with [us], [end if][we] [can] see [the list of nonplayer things under the noun with indefinite articles].";
	continue the action.

See Matt’s reply. Generally, Inform provides a simple world model and allows for the user to alter it to add complexity. You say “If a supporter should be fixed in place, you can simply define it that way”, but it’s equally true that if a supporter should be portable, you can simply define it that way. Inform had to pick a default, and most supporters that I’ve seen in text adventures are things like tables, desks, and beds that players can’t pick up and carry around in their inventory.

…and, to this specific argument, players can’t push those things between rooms either.

Enterable supporters also include vehicles (rafts, etc). But again, it’s more common for these to be motivated by controls (motorized vehicles) or by environmental rules (boats). Pushable vehicles are the uncommon case.

Well, what can I say but THANKS A LOT for all these solutions, vlaviano - you’re a great help for me! :slight_smile: :slight_smile: :slight_smile:
I can understand the conventions for supporters a bit better.
I didn’t know that writing the room header with the over under convention is that complicated, so sorry if I exploited your expertise…

I noticed a problem with the pushing under rulebook: If a super thing is taken, all the sub things are still listed when examining the item. I couldn’t find the line that removes both over and under conventions - taking a sub only removes the “under” but not the “over”. Am I mistaken? I tried this with something hanging over a door, took it and I still got the “(under which you can see a door)” line when examining it while holding it.
Could you check this? Thanks! :slight_smile:

P.S.: I will get back to you once I’ve tried to implement the pulling and putting conventions abiding by the pushing rulebook.

  • resolved -
  • resolved -

I have another problem: When the player is on a sub supporter and takes the super, examining the super will still list the player and the sub supporter.
There’s already the line After taking or pushing a super thing: now all things under the noun are not under the noun; continue the action. which should remove everything under the super but somehow it doesn’t work when the player is on a supporter under the super.

I hope I’m not too demanding in this matter… please tell me if I am!

(I’m assuming that these both describe the same issue. Let me know if I’m wrong about that.)

In my version of the program, this issue doesn’t exist.

Are you sure that the after rule is being run, or is it possible that the action is being intercepted by another rule (e.g., an instead rule)?

To determine this, you can use the RULES debug command before taking the super, or you can stick an “I’m running!” msg in your after rule.

If the after rule is being run, then I’d suggest trimming your program down to be as small as possible while still demonstrating the issue and posting it here.

I didn’t do as much as you think there. I copied the rule from the Standard Rules that prints the suffixes like “(on the sofa)” or “(in the cage)” and added two lines to it. Then I told Inform to use my new version instead of the original one.

Sorry for not posting for so long.
Here is my trimmed-down code. I cannot find the problem… :\

[spoiler][code]Definition: a supporter is occupied if it supports something.
Definition: a supporter is empty if it is not occupied.
Before pushing an enterable supporter (called a chair):
if the chair supports a person:
say “I don’t think [a list of persons on the noun] want[s] to be pushed around.”;
stop the action.
Instead of entering an enterable occupied supporter:
if the noun supports a person:
say “You cannot get on [the noun], because it is currently occupied by [a list of persons on the noun].”;
otherwise:
say “You squeeze on [the noun] next to [the list of things supported by the noun].”.
Before pushing an occupied enterable supporter to a direction:
if the noun supports a person:
say “I don’t think [list of persons on the noun] want[s] to be pushed around.”;
stop the action;
otherwise:
say “You push [the noun] [second noun][if the noun is occupied], together with [the list of things supported by the noun][end if].”;
continue the action.

Definition: a container is non-empty if it contains something.
Definition: a container is empty if it contains nothing.
Definition: a container is full if the number of things in the noun is the carrying capacity of the noun.

[+++ reachability +++]
A thing can be reachable or unreachable. A thing is usually reachable.
Definition: A thing is unreachable if it is not reachable.

Instead of doing something other than examining or standing under or pushing or pulling to an unreachable thing:
say “You can’t reach [the noun] from here.”

Instead of eating or drinking something inedible, say “I have another understanding of food.”

[+++ vertical arrangement relation +++]

[Section 1 - Vertical Arrangement]

Vertical arrangement relates various things to one thing (called the uber).
The verb to be under means the vertical arrangement relation.
The verb to be over means the reversed vertical arrangement relation.

Definition: a thing is sub if it is under something.
Definition: a thing is super if it is over something.

Rule for printing room description details of a sub thing (called S):
say " (under [the uber of S])"

After examining a sub thing:
say “[The noun] [are] under [the uber of the noun].”;
continue the action.

[After examining a super thing:
if the player is under the noun:
say “[We] [are] currently standing under [the noun].”;
otherwise:
say “Underneath [the noun] [we] [can] see [the list of things under the noun with indefinite articles].”;
continue the action.]

Definition: a thing is nonplayer if it is not the player.

After examining a super thing:
if the number of nonplayer things under the noun > 0:
say “Underneath [the noun] [we] [can] see [the list of nonplayer things under the noun with indefinite articles].”;
if the player is under the noun:
say “[We] [are] currently standing under [the noun].”;
continue the action.

A thing can be uberistic or non-uberistic. A thing is usually non-uberistic.

test bells with “push chair under bells / get on chair /x bells / take bells / x bells / get off / x bells”

[Section 2 - Pushing/Pulling It Under]

Pushing it under is an action applying to two things.
Pulling it under is an action applying to two things.
Putting it under is an action applying to two things.

Understand “push [something] under [something]” as pushing it under.
Understand “pull [something] under [something]” as pulling it under.
Understand “put [something] under [something]” as putting it under.

[Instead of putting something under an uberistic thing (called an UT):
say “I’ll try pushing [the noun] under [the second noun] instead.”;
try pushing the noun under the UT.]

Check pushing it under when the second noun is non-uberistic (this is the can’t push something under something non-uberistic rule):
instead say “[We] [can’t push] anything under [the second noun]. There’s no space under it.” (A).
Check pulling it under when the second noun is non-uberistic (this is the can’t pull something under something non-uberistic rule):
instead say “[We] [can’t pull] anything under [the second noun]. There’s no space under it.” (A).
Check putting it under when the second noun is non-uberistic (this is the can’t put something under something non-uberistic rule):
instead say “[We] [can’t put] anything under [the second noun]. There’s no space under it.” (A).

Check pushing it under when the noun is the second noun (this is the can’t push something under itself rule):
instead say “[We] [can’t push] [the noun] under [themselves].” (A).
Check pulling it under when the noun is the second noun (this is the can’t pull something under itself rule):
instead say “[We] [can’t pull] [the noun] under [themselves].” (A).
Check putting it under when the noun is the second noun (this is the can’t put something under itself rule):
instead say “[We] [can’t put] [the noun] under [themselves].” (A).

Check pushing it under when the player encloses the noun (this is the can’t push something held under rule):
instead say “[We] [can’t push] [the noun] while [we]['re] carrying [regarding the noun][them].” (A).
Check pulling it under when the player encloses the noun (this is the can’t pull something held under rule):
instead say “[We] [can’t pull] [the noun] while [we]['re] carrying [regarding the noun][them].” (A).

Check pushing it under when the player encloses the second noun (this is the can’t push something under something held rule):
instead say “[We] [can’t push] [the noun] under [the second noun] while [we]['re] carrying [regarding the second noun][them].” (A).
Check pulling it under when the player encloses the second noun (this is the can’t pull something under something held rule):
instead say “[We] [can’t pull] [the noun] under [the second noun] while [we]['re] carrying [regarding the second noun][them].” (A).

[May need to relax this for pushing furniture around]
To move is a verb.
Check pushing a fixed in place thing under (this is the can’t push fixed in place things under rule):
instead say “[We] [can’t move] [the noun].” (A).
Check pulling a fixed in place thing under (this is the can’t pull fixed in place things under rule):
instead say “[We] [can’t move] [the noun].” (A).

Check pushing it under when the noun is under the second noun (this is the can’t push something under its uber rule):
instead say “[The noun] [are] already under [the second noun].” (A).
Check pulling it under when the noun is under the second noun (this is the can’t pull something under its uber rule):
instead say “[The noun] [are] already under [the second noun].” (A).

Check pushing it under when the noun is over the second noun (this is the can’t push something under its subordinate rule):
instead say “[We] [can’t push] [the noun] under [the second noun], because [the second noun] [are] under [the noun].” (A).
Check pulling it under when the noun is over the second noun (this is the can’t pull something under its subordinate rule):
instead say “[We] [can’t pull] [the noun] under [the second noun], because [the second noun] [are] under [the noun].” (A).

Check pushing it under when the second noun encloses noun (this is the can’t push something under its container or supporter rule):
instead say “[We] [can’t push] [the noun] under [the second noun], because [the noun] is already [if the second noun is a container]in[else]on[end if] [the second noun].” (A).
Check pulling it under when the second noun encloses noun (this is the can’t pull something under its container or supporter rule):
instead say “[We] [can’t pull] [the noun] under [the second noun], because [the noun] is already [if the second noun is a container]in[else]on[end if] [the second noun].” (A).

Check pushing it under when the noun encloses the second noun (this is the can’t push something under its contents rule):
instead say “[We] [can’t push] [the noun] under [the second noun], because [the second noun] [are] in [the noun].” (A).
Check pulling it under when the noun encloses the second noun (this is the can’t pull something under its contents rule):
instead say “[We] [can’t pull] [the noun] under [the second noun], because [the second noun] [are] in [the noun].” (A).

Instead of putting something under an uberfull thing when a supporter is under the second noun:
let S be a random supporter that is under the second noun;
say “(putting [the noun] on [the S], because there are already too many things under [the second noun])[command clarification break]”;
try putting the noun on S.

[TODO: component parts. See tests with bucket handle.]

Carry out pushing it under:
now all things under the noun are not under the noun;
now the noun is under the second noun.
Carry out pulling it under:
now all things under the noun are not under the noun;
now the noun is under the second noun.

Report pushing it under (this is the report pushing it under rule):
say “[We] [push] [the noun] under [the second noun].” (A).
Report pulling it under (this is the report pulling it under rule):
say “[We] [pull] [the noun] under [the second noun].” (A).

[TODO: If we have pushing it under, we should probably have putting it under as well]

[Section 3 - Severing the Relation]

The pushing action has an object called the old uber.
The pulling action has an object called the old uber.

Setting action variables for pushing:
now the old uber is nothing.
Setting action variables for pulling:
now the old uber is nothing.

Before pushing a sub thing:
[save the uber before clearing it so we can use it in our report rule later]
now the old uber is the uber of the noun.
Before pulling a sub thing:
[save the uber before clearing it so we can use it in our report rule later]
now the old uber is the uber of the noun.

After taking or pushing a sub thing:
now the noun is not under the uber of the noun;
continue the action.
After pulling a sub thing:
now the noun is not under the uber of the noun;
continue the action.

After taking or pushing a super thing (called a sup):
now all things under the noun are not under the sup;
continue the action.
After pulling a super thing:
now all things under the noun are not under the noun;
continue the action.

After putting something on a sub supporter:
now the noun is under the uber of the second noun;
continue the action.

Report pushing when the old uber is not nothing (this is the report pushing a sub thing rule):
instead say “[We] [move] [the noun] out from under [the old uber].” (A).
Report pulling when the old uber is not nothing (this is the report pulling a sub thing rule):
instead say “[We] [move] [the noun] out from under [the old uber].” (A).

The report pushing a sub thing rule is listed first in the report pushing rules.
The report pulling a sub thing rule is listed first in the report pulling rules.

Moving out is an action applying to one thing. Understand “move [something]” as moving out.

Carry out moving out a sub thing:
now the noun is not under the uber of the noun;
now the uber of the noun is not over the noun.

Instead of moving out yourself when the player is sub:
now the player is not under the uber of the player.

Carry out moving out a super thing:
now all things under the noun are not under the noun.

Before entering something that is not sub:
if the player is sub, now the player is not under the uber of the player.

[Section 4 - Coverage Capacity]

A thing has a number called coverage capacity. The coverage capacity of a thing is usually 0.

When play begins:
repeat with U running through uberistic things:
now the coverage capacity of U is 999.

Definition: a thing is uberfull if the number of things under it >= its coverage capacity.

Check pushing it under when the second noun is uberfull (this is the can’t push something under an uberfull thing rule):
instead say “[if the coverage capacity of the second noun is 0][We] [can’t put] anything under [the second noun][else][The second noun] already [have] too many things under [them][end if].” (A).
Check pulling it under when the second noun is uberfull (this is the can’t pull something under an uberfull thing rule):
instead say “[if the coverage capacity of the second noun is 0][We] [can’t put] anything under [the second noun][else][The second noun] already [have] too many things under [them][end if].” (A).

[Section 5 - Standing Under]

Standing under is an action applying to one thing.
Understand “Stand under [something]” as standing under.
To stand is a verb.

[TO DO: Printing room descripton with addition (under the noun)]

Check standing under when the noun is non-uberistic (this is the can’t stand under a non-uberistic thing rule):
instead say "There’s no place to stand under [the noun]. " (A).

Check standing under when the noun is enclosed by the player (this is the can’t stand under a thing enclosed by the player rule):
instead say “[We] [can’t] stand under [the noun] while [we] [are] holding it.” (A).

Check standing under when the noun is uberfull (this is the can’t stand under an uberfull thing rule):
if an enterable supporter (called an underporter) is under the noun:
silently try entering the underporter;
now the player is under the noun;
instead say “[We] [can’t] find any more space to stand under [the noun].” (A).

Instead of standing under an uberfull thing (called the UFT) when an enterable supporter is under the second noun:
let ES be a random enterable supporter that is under the second noun;
say “(getting onto [the ES], because there are already too many things under [the second noun])[command clarification break]”;
try entering ES;
now the player is under the UFT.

After entering a sub supporter:
now the player is under the uber of the noun;
continue the action.

Carry out entering when the noun is a sub thing (called the sub):
now the player is under the sub.

After exiting from a sub supporter:
if the player is sub, now the player is not under the uber of the player;
if the holder of the player is sub, now the player is under the uber of the holder of the player;
continue the action.

Carry out standing under:
now the player is under the noun.

To position is a verb.

Report standing under:
say “[We] [position] [ourselves] under [the noun][if the list of nonplayer things under the noun is not empty] next to [the list of nonplayer things under the noun][end if].”

Carry out going when the player is under something (called the header):
now the player is not under the header.

AB front is a room with printed name “Bookshop (front)”.

Some brass bells are in AB front. The brass bells are unreachable. The bells are uberistic. The coverage capacity of the brass bells is 1.

Before taking the brass bells:
if the player is under the brass bells and the player is on an enterable sub supporter:
now the brass bells are reachable.

A small chair is furniture in AB front.

After taking the brass bells, say “You remove the brass bells from the fixture as carefully as possible to not make them jingle.”.[/code][/spoiler] Thanks for your help! :slight_smile:

Here’s the output from a rules trace of your program. (I had to change “furniture” to “enterable portable supporter” to make it compile.)

What’s happening is that your “After taking the brass bells” rule is running before the rest of the After rules; since it doesn’t contain “continue the action,” it stops execution of the action, and the “After taking or pushing a super thing” rule never runs.

Maybe I missed this earlier in the thread, but do the rules for taking or pushing a super thing have to be After rules? It seems to me that it would make sense to make them Carry out rules–you’d need separate Carry out taking and Carry out pushing rules–because they actually implement some effects of the action. That way you won’t run the risk of interrupting them with an After rule that’s meant to print a message and preempt the Report rules, which is what happened here.

Perfect! Thanks! :smiley: :smiley: :smiley:

I’ve substituted all the after rules with carry out rules because it absolutely makes sense to me.