1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-07 17:44:22 +03:00
inform7/resources/Documentation/Examples/TinyGarden.txt
2023-07-24 11:56:58 +01:00

32 lines
1.8 KiB
Plaintext

Example: ** Tiny Garden
Location: Text with lists
RecipeLocation: Continuous Spaces and The Outdoors
Index: Continuous space, simple
Description: A lawn made up of several rooms, with part of the description written automatically.
For: Z-Machine
Sometimes we want to make a list of something too complicated to express in a say list... phrase. When this happens, we can instead mark all the items we want to mention as "marked for listing".
In this case, we have a lawn area made up of four rooms. We want each room to automatically describe the directions leading to the other parts of the lawn. To do this, we will first determine which directions are relevant and mark those for listing, then list them.
{*}"Tiny Garden"
The Herb Garden is a room. "Along this side of the house run your great-aunt's herb beds."
A Grassy Room is a kind of room. The printed name of a Grassy Room is usually "Lawn". The description of a Grassy Room is "The grass underfoot is thick and green. The lawn extends to [grassy directions] from here."
The following phrase goes through all the directions in the compass and marks the ones that are interesting to us at the moment.
{**}To say grassy directions:
repeat with that way running through directions:
if the room that way from the location is a grassy room,
now that way is marked for listing;
say "[a list of directions which are marked for listing]";
now every direction is not marked for listing.
Lawn1 is west of the Herb Garden. It contains a picnic table and a wicker basket. Lawn2 is south of Lawn1 and southeast of Lawn4. Lawn3 is southwest of Lawn1, west of Lawn2, and south of Lawn4. Lawn4 is west of Lawn1. Lawn4 contains a birdbath. The birdbath is fixed in place.
Lawn1, Lawn2, Lawn3, and Lawn4 are Grassy Rooms.
Test me with "w / s / w / n".