Chapter 8: Change
8.8. Moving backdrops

A backdrop can be in several rooms at once. When created, its position can be given as any specific collection of rooms, or as a region, or even as "everywhere". For instance:

The Upper Cave is above the Rock Pool. The Ledge is east of the Pool.

The stream is a backdrop. It is in the Upper Cave and the Ledge.

Moving backdrops is not like moving other things, because there's no single destination. There are several possibilities:

(a) A backdrop can be moved to a region. If we define:

Lower Level is a region. The Rock Pool and the Ledge are in the Lower Level.

then we can write either of

move the stream to the Lower Level;
now the stream is in the Lower Level;

and either way, the stream is now found in the Rock Pool and the Ledge but nowhere else.

(b) A backdrop can be moved to a category of rooms:

move (object) backdrop to all (description of objects)

This phrase moves the backdrop so that it is now present in every room matching the given description. Example: If we define

A room can be wet or dry. A room is usually dry. The Rock Pool is wet.

then we can write

move the stream backdrop to all wet rooms;

This phrasing, "move the ... backdrop to all ..." is deliberately meant to look unlike the simpler "move ... to ...", to emphasise that this kind of movement is possible only for backdrops.

What then happens is that the stream is present in whichever rooms are currently wet. But the stream's position is ordinarily checked only after movements, for efficiency's sake. So if the player is in a room which suddenly changes from being dry to being wet, the stream will not magically appear (though it will be there if the player goes out and comes in again). If this is not good enough, the phrase "update backdrop positions" can be used to ensure the accuracy of all backdrop locations after a dramatic change:

update backdrop positions

This phrase runs through all backdrops in the model world and makes sure they are correctly in, or not in, the current location, so that everything appears right from the player's point of view. Example:

The Upper Cave is above the Rock Pool. The Ledge is east of the Pool. The stream is a backdrop.

When play begins:
    move the stream backdrop to all wet rooms.

A lever is in the Cave. The lever is fixed in place.

Instead of pulling the lever when the Cave is dry:
    now the Cave is wet;
    now the lever is in the Rock Pool;
    now the lever is portable;
    update backdrop positions;
    say "The old rusty lever pulls away, and the thin cave wall goes with it, so that a stream bursts into the cave, falling to the pool below."

(c) A backdrop can be removed from play, just as anything else can be: see the later section in this chapter.


120
*** Example  Orange Cones
Creating a traffic backdrop that appears in all road rooms except the one in which the player has laid down orange cones.

RB

Because we can invent our own adjectives (see the chapter on Phrases), we can make the conditions for a backdrop as simple or as complicated as we like.

In this scenario, we want the player to be able to take, move, and drop orange traffic cones to seal off one street or another. So we create our own "accessible" adjective as follows:

Definition: a road is accessible if the orange cones are not in it.

...and now

move the traffic backdrop to all accessible roads.

will tell the traffic backdrop where to appear.

"Orange Cones"

A road is a kind of room.

The traffic is a backdrop. It is not scenery. The initial appearance is "Dense traffic snarls the streets, making it difficult to cross even with the lights. Men on motorbikes edge between the cars, and sometimes pull up onto the sidewalks to go around." The description is "It is more or less as usual for this time of day. It's a wonder it ever dissipates, really."

When play begins:
    move the traffic backdrop to all accessible roads.

A line of orange cones are a thing.

Definition: a road is accessible if the orange cones are not in it.

After dropping the orange cones in a road:
    say "With steely determination you begin to lay out the orange cones, blocking access to this segment of street. This produces honking and swearing -- but you persevere.";
    update backdrop positions.

After taking the orange cones:
    say "You go around taking up the orange cones, and within moments the traffic begins to flow into the street again.";
    update backdrop positions.

That accomplishes everything we set out to do, but let's add a very simple puzzle to test it out with:

The Town Square is a road. North of the Town Square is Candle Street. Candle Street is a road. East of Town Square is Mortar Street. Mortar Street is a road.

The line of orange cones are in Mortar Street.

The player wears a reflective vest and a hard hat.

The manhole cover is a door. "[if location is accessible]Under the cars in the middle of the street, you can just make out the cover of the manhole you need to get into.[otherwise]There's a promising manhole in the middle of the street.[end if]". It is closed and openable. It is below the Town Square and above the Access Tunnel.

Instead of opening the manhole cover when the location is an accessible road:
    say "You can't get anywhere near the manhole cover with all these cars above it."

Instead of taking the orange cones in Town Square:
    if the manhole cover is closed or Town Square is accessible, continue the action;
    otherwise say "You'd better not let the traffic back in until you've closed the manhole. There'll be accidents otherwise."

After going to the Access Tunnel:
    say "With a stealthy glance left and right, you lower yourself into the access tunnel, thus accomplishing your mission for Chapter 2. To continue your adventure, see Chapter 3: The Vault of Peaquod.";
    end the story finally.

And finally, a couple of features from the Activities chapter to make the output more elegant:

Rule for writing a paragraph about the orange cones: say "A line of orange cones holds back the traffic from entering here."

Rule for printing the name of the orange cones when the cones are carried by the player:
    say "stack of orange cones".

Test me with "x traffic / open manhole / n / x traffic / s / e / x traffic / get cones / look / x traffic / w / drop cones / look / open manhole / take cones / d".


PreviousContentsNext