Orange Cones
Example 120
★★★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".
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".
Town Square
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.
Under the cars in the middle of the street, you can just make out the cover of the manhole you need to get into.
>(Testing.)
>[1] x traffic
It is more or less as usual for this time of day. It's a wonder it ever dissipates, really.
>[2] open manhole
You can't get anywhere near the manhole cover with all these cars above it.
>[3] n
Candle Street
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.
>[4] x traffic
It is more or less as usual for this time of day. It's a wonder it ever dissipates, really.
>[5] s
Town Square
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.
Under the cars in the middle of the street, you can just make out the cover of the manhole you need to get into.
>[6] e
Mortar Street
A line of orange cones holds back the traffic from entering here.
>[7] x traffic
You can't see any such thing.
>[8] get cones
You go around taking up the orange cones, and within moments the traffic begins to flow into the street again.
>[9] look
Mortar Street
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.
>[10] x traffic
It is more or less as usual for this time of day. It's a wonder it ever dissipates, really.
>[11] w
Town Square
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.
Under the cars in the middle of the street, you can just make out the cover of the manhole you need to get into.
>[12] drop cones
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.
>[13] look
Town Square
A line of orange cones holds back the traffic from entering here.
There's a promising manhole in the middle of the street.
>[14] open manhole
You open the manhole cover.
>[15] take cones
You'd better not let the traffic back in until you've closed the manhole. There'll be accidents otherwise.
>[16] d
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.
*** The End ***
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.
Under the cars in the middle of the street, you can just make out the cover of the manhole you need to get into.
>(Testing.)
>[1] x traffic
It is more or less as usual for this time of day. It's a wonder it ever dissipates, really.
>[2] open manhole
You can't get anywhere near the manhole cover with all these cars above it.
>[3] n
Candle Street
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.
>[4] x traffic
It is more or less as usual for this time of day. It's a wonder it ever dissipates, really.
>[5] s
Town Square
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.
Under the cars in the middle of the street, you can just make out the cover of the manhole you need to get into.
>[6] e
Mortar Street
A line of orange cones holds back the traffic from entering here.
>[7] x traffic
You can't see any such thing.
>[8] get cones
You go around taking up the orange cones, and within moments the traffic begins to flow into the street again.
>[9] look
Mortar Street
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.
>[10] x traffic
It is more or less as usual for this time of day. It's a wonder it ever dissipates, really.
>[11] w
Town Square
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.
Under the cars in the middle of the street, you can just make out the cover of the manhole you need to get into.
>[12] drop cones
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.
>[13] look
Town Square
A line of orange cones holds back the traffic from entering here.
There's a promising manhole in the middle of the street.
>[14] open manhole
You open the manhole cover.
>[15] take cones
You'd better not let the traffic back in until you've closed the manhole. There'll be accidents otherwise.
>[16] d
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.
*** The End ***