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/Elsie.txt
2023-07-24 11:56:58 +01:00

28 lines
1.5 KiB
Plaintext

Example: ** Elsie
Location: The past and perfect tenses
RecipeLocation: Doors, Staircases, and Bridges
Index: An automatically closing door
Description: A door that closes automatically one turn after the player opens it.
For: Z-Machine
Suppose we want to create an automated door of the sort that closes when it isn't in use. A convenient way is to write a rule that fires "every turn when the sliding door was open". This will be true only if the door was open at the beginning of the turn: if the player just opened it this turn, it stays open, and if it was already closed, it stays closed. Thus:
{*}"Elsie"
The axis-ward is a direction. The opposite of axis-ward is hub-ward. Understand "aw" or "axisward" as axis-ward.
The hub-ward is a direction. The opposite of hub-ward is axis-ward. Understand "hw" or "hubward" as hub-ward.
The Ship's Bridge is a room.
The sliding door is a door. It is axis-ward from Bridge and hub-ward from C Deck. The initial appearance is "There is a door in this wall[if closed] -- or at least, the potential for a door, since currently it is sealed, distinguishable from the rest of the wall only by the warning stripes on its surface[end if]."
Every turn when the sliding door was open:
now the sliding door is closed;
if the player can see the sliding door:
say "The sliding door slips back into place, sealing the wall as though there had never been a breach."
After opening the sliding door:
say "You press the appropriate buttons, and a section of wall slides away."
Test me with "open door / look / enter door / z".