OnStage routine and rooms

The routine OnStage() (in the WorldModel.i6t template) is defined as:

[ OnStage O set x;
	    if (O ofclass K1_room) rfalse; 					! room check #1
	    if (set < 0) {
	            while (metaclass(O) == Object) {
	                    if (O ofclass K1_room) rtrue;	! room check #2
	                    if (O ofclass K9_region) rfalse;
	                    if (O ofclass K4_door) rtrue;
	                    if (O ofclass K7_backdrop) { if (O has absent) rfalse; rtrue; }
	                    x = O.component_parent; if (x) { O = x; continue; }
	                    x = parent(O); if (x) { O = x; continue; }
	                    rfalse;
	            }
	    }
...

I’ve added two comments to places where the class of the object being tested is checked to see whether it is a room.

It looks like the second check shouldn’t be there. First, it doesn’t look like it can ever have an effect because the first check takes precedence. Second, there is relevant commentary in WWI 8.10 Removing things from play:

Note that “on-stage” and “off-stage” apply only to things. Rooms, directions and regions are the stage itself: so it makes no sense to ask the question of whether they are “on-” or “off-”.

Is there a purpose or function to the second check that I’m not seeing?

1 Like

You missed the while loop!

If O is inside a container, O will be set to that container and then the loop continues. Same for supporters, components, etc. O walks up the chain of holders until it reaches either a room (on-stage) or an object whose holder is nothing (off-stage).

(Or a backdrop or door or region, which are special cases. Looks like the routine has no concept of off-stage doors, which makes sense – the Standard Rules don’t allow doors to be off-stage.)

2 Likes

If one asks whether rooms, regions, or directions are off-stage, it’s true. And if you ask whether they’re offstage, it’s false. I figure it’s not a bug given it’s explicitly undefined behavior.

These are the definitions:

Definition: Something is on-stage rather than off-stage if I6 routine "OnStage"
    makes it so (it is indirectly in one of the rooms).
Definition: Something is offstage if it is off-stage.

It says something. So there’s an implicit if it is a thing and in front of the conditional. For a non-thing, the result for both is always false – it doesn’t even get as far as checking the I6 OnStage routine.

And false for the first means off-stage and false for the second means not offstage.

One would get consistent false (as in not indicating being on stage) results for room, region, direction with this:

Definition: An object is offstage if it is off-stage.
1 Like

Thank you, zarf. I was too tired when I was trying to think it through the first time, obviously… but hey – it looks like I got my first really thoughtless post in early this year!

I note that the reliance on absent for defining whether a backdrop is on-stage means that “an on-stage backdrop” is synonymous with “a not absent backdrop” instead of “a backdrop that is currently located on-stage” (as it means for other kinds of things) or even “a backdrop that is ready to be placed on-stage the next time it’s needed” (since it’s possible for a backdrop with a routine-based .found_in to be counted as on-stage even if it will not be present in any room under current conditions).

And thank you, Zed for the amusing sidebar regarding the hyphenated vs. non-hyphenated versions of the adjective. I think that the inconsistency you noted counts as a minor bug despite the undefined behavior.

Probably most importantly, a backdrop can be on-stage and nowhere at the same time, since being nowhere depends on the location of something and the location of a backdrop is poorly-defined. So, don’t use ‘if (a-backdrop) is/is not nowhere’- always use ‘if (a backdrop) is on-stage/off-stage’.