Elsie
Example 151
★★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".
Test me with "open door / look / enter door / z".
Ship's Bridge
There is a door in this wall -- 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.
>(Testing.)
>[1] open door
You press the appropriate buttons, and a section of wall slides away.
>[2] look
Ship's Bridge
There is a door in this wall.
The sliding door slips back into place, sealing the wall as though there had never been a breach.
>[3] enter door
(first opening the sliding door)
You press the appropriate buttons, and a section of wall slides away.
C Deck
There is a door in this wall.
>[4] z
Time passes.
The sliding door slips back into place, sealing the wall as though there had never been a breach.
There is a door in this wall -- 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.
>(Testing.)
>[1] open door
You press the appropriate buttons, and a section of wall slides away.
>[2] look
Ship's Bridge
There is a door in this wall.
The sliding door slips back into place, sealing the wall as though there had never been a breach.
>[3] enter door
(first opening the sliding door)
You press the appropriate buttons, and a section of wall slides away.
C Deck
There is a door in this wall.
>[4] z
Time passes.
The sliding door slips back into place, sealing the wall as though there had never been a breach.