Getting off stacked supporters

…is there an elegant way to do this? I want the command “get down” to have the player end up on the ground no matter which supporter they’re currently standing on within a “stack” of supporters. I tried the below, but it only exits the current supporter (i.e. you only go one step down) and I can’t seem to figure out how to include multiple actions under one If clause:

getting down is an action applying to nothing.
Understand "get down" as getting down.
Instead of getting down:
	if the player is not on a supporter:
		say "You're not standing on anything at the moment.";
	otherwise if the player is on the tricycle:
		if the tricycle is on the table:
			if the table is on the couch:
				try getting off the tricycle;
				try getting off the table;
				try getting off the couch;
			otherwise:
				try getting off the tricycle;
				try getting off the table;
		if the tricycle is on the couch:
			try getting off the tricycle;
			try getting off the couch;
		otherwise:
			try getting off the tricycle;
	otherwise if the player is on the table:
		if the table is on the couch:
			try getting off the table;
			try getting off the couch;
		otherwise:
			try getting off the table;
	otherwise if the player is on the couch:
		try getting off the couch.

How do you want to accomplish this, stepping off each supporter individually and then off altogether or getting off altogether?

1 Like

I opened up the Standard Rules to see how getting off an enterable supporter works. Turns out it moves the player to “the not-counting-parts holder of the noun”, which, if the supporter’s on another supporter, means the previous supporter.

Carry out an actor getting off (this is the standard getting off rule):
	let the former exterior be the not-counting-parts holder of the noun;
	surreptitiously move the actor to the former exterior.

If by wanting to get the player to “the ground” you mean the base level of any room, then we can achieve this by replacing the above rule.

I’ve attached a demo which turns off the rule above, replaces it with a new one which always puts us back at the base level of the room we’re in, “the location”, and then shows it works for all three levels of the three-level supporter stack in the demo. I haven’t made the appearance of the stack of things any nicer (they appear as a series of item names in nested brackets) but I have shown that this code will work to get you to the ground in one move with any of the usual ‘get off’-type commands.

lab is a room. a crate is an enterable supporter in lab. a ladder is an enterable supporter on crate. a stool is an enterable supporter on ladder.

The standard getting off rule does nothing.

Carry out an actor getting off (this is the NEW getting off rule):
	surreptitiously move the actor to the location;

Test me with "get on stool/get off/get on ladder/get down/get on stool/get off".

I also haven’t addressed @mattdevins question about whether we want better messages as we get off all these stacked things. I just started with getting to the ground.

-Wade

3 Likes

Here’s a version with messages for the intermediate steps. It amalgamates several rules for the getting off action from the Standard Rules:

The Lab is a room.

The table is an enterable supporter in the Lab.
The chair is an enterable supporter on the table.
The stool is an enterable supporter on the chair.
The cushion is an enterable supporter on the stool.

The player is on the cushion.

Before an actor getting off (this is the get-off-everything rule):
	if the actor is not on the noun and the actor is not carried by the noun:
		if the actor is the player:
			say "But [we] [aren't] on [the noun] at the [if story tense is present
				tense]moment[otherwise]time[end if]." (A);
		stop the action;
	otherwise:
		if the action is not silent:
			say "[The actor] [get] off [the noun]." (B);
		let the former exterior be the not-counting-parts holder of the noun;
		if the former exterior is not the location: 
			[we don't print the room description for the intermediate steps]
			surreptitiously move the actor to the former exterior;
			try getting off the former exterior;
		otherwise:
			move the actor to the former exterior;
		stop the action;

Output:

Lab (on the cushion) (on the stool) (on the chair) (on the table)

>get down
You get off the cushion.

You get off the stool.

You get off the chair.

You get off the table.

Lab
You can see a table (on which is a chair (on which is a stool (on which is a cushion))) here.

Normally, it’s not best practice to cobble together the rules which concern different stages (Check, Carry Out, Report) like this. I just wanted to show it as a possible way to implement the scenario.

3 Likes

Simplest way is to move the player to “the location”. I used JUMP instead of GET DOWN (which could cause problems if down feathers are an inventory item!) but same idea. (You’d probably want to do checks also based on your other game elements instead of an INSTEAD rule.)

Laboratory
You can see a ladder (on which is a precarious beach ball) here.

enter ladder
You get onto the ladder.

On the ladder you can see a precarious beach ball.

enter ball
You get onto the precarious beach ball.

l
Laboratory (on the precarious beach ball) (on the ladder)

jump
Laboratory
You can see a ladder (on which is a precarious beach ball) here.

You take a careful leap and land on the floor.

l
Laboratory
You can see a ladder (on which is a precarious beach ball) here.

GET DOWN is actually already defined as EXITing which will take the player one level down in the precarious stack:

ENTER LADDER
You get onto the ladder.

On the ladder you can see a precarious beach ball.

ACTIONS
Actions listing on.

GET DOWN
[exiting]
[(1) getting off the ladder]
You get off the ladder.

Laboratory
You can see a ladder (on which is a precarious beach ball) here.

[(1) getting off the ladder - succeeded]

[exiting - succeeded]

You may wish to leave GET DOWN as is, and create your command to get back to the floor as JUMP DOWN, then just “instead of jumping down: try jumping”.

5 Likes

I want my chance too!

Lab is a room. 

The table is an enterable supporter in the lab. The large box is an enterable supporter on the table. The small box is an enterable supporter on the large box.

Understand the command "get" as something new.
Understand "get [things]" as taking.
Understand "get in/on" as entering.
Understand "get in/into/on/onto [something]" as entering.

Understand the command "exit" as something new.

jumping off is an action applying to nothing.
Understand "get off/down", "exit" as jumping off.

Jumping-off is a truth state which varies. Jumping-off is false.
The old supporter is a thing which varies. 
Former supporters is a list of things which varies.

Check jumping off:
	if the player is not supported by something:
		say "You're not on anything." instead;

Carry out jumping off:
	truncate former supporters to 0 entries;
	now the old supporter is a random thing which supports the player;
	now jumping-off is true;
	while something (called the current supporter) supports the player:
		silently try getting off the current supporter;
		if the current supporter supports the player:
			rule fails;
		add the current supporter to former supporters;
	now jumping-off is false;
	
Report jumping off:
	say "You get off [former supporters with definite articles].";
	follow the describe room stood up into rule.

the describe room stood up into rule does nothing when jumping-off is true.

test me with "get on small box/get off".

There are a few more things to polish/fix here, but it pretty much works.

3 Likes

Thank you all so much, you are awesome humans!

@mattdevins to answer your question: I’m inclined towards the latter…but will probably try out both, now that I’m inspired :slight_smile: