"Advent Door" by Andrew Plotkin.
[IFID:B13B1B1B-729A-4B8D-A1AC-0AF0CF8BA11A]

The story headline is "An interactive Advent calendar entry".
The release number is 3.

[
Copyright 2019-20 Andrew Plotkin <erkyrath@eblong.com>
<http://eblong.com/zarf/if.html>

This source code is provided for personal, educational use only. The story and text of _ Advent Door_ belong to me; you may not use them or create derivative works which contain them. However, you have permission to use the programming techniques of this game in your own works, and you may use the source code excluding game text.

If you want to *play* this game, you're in the wrong place. Go to my web site: <http://eblong.com/zarf/zweb/doorsday/>

Obvious warning: This code contains spoilers! If you haven't played _ Advent Door_, and you read this code, you'll certainly ruin the game for yourself. Play it first. I am releasing this code for the benefit of Inform programmers who are familiar with the game and want to know how I did it.

I implemented this game using Inform 7 build 6M62. It probably won't work with earlier releases, and I can't make guarantees about future ones.
]

Chapter - General Stuff

Use American dialect.
Use the serial comma.

To say em -- running on: (- style underline; -).
To say /em -- running on: (- style roman; -).
To say para -- running on: (- DivideParagraphPoint(); new_line; -).

A thing can be known or unknown. A thing is usually unknown.
A room can be known or unknown. A room is usually unknown.

A room can be whispered.
A room has a number called the counter.
A room has a number called the timer.

A key is a kind of thing.

Check exiting when the location is a room:
if the arch is in the location:
instead try entering the arch;
instead say "That's the question, isn't it."

Check going outside:
if the arch is in the location:
instead try entering the arch;
instead say "That's the question, isn't it."

The taking action has a thing called the previously-linked.

Setting action variables for taking:
now the previously-linked is not-a-wall.

Chapter - Dirnames

[The cardinal directions are of course heavily used in this game. Here I define a value-kind for that. I could instead have used the built-in direction objects as properties, but I didn't.]
A dirname is a kind of value.
The dirnames are dir-none, dir-north, dir-south, dir-east, dir-west, dir-ne, dir-nw, dir-se, dir-sw.

Understand "n", "north", "northern" as dir-north.
Understand "s", "south", "southern" as dir-south.
Understand "e", "east", "eastern" as dir-east.
Understand "w", "west", "western" as dir-west.
Understand "ne", "northeast" as dir-ne.
Understand "nw", "northwest" as dir-nw.
Understand "se", "southeast" as dir-se.
Understand "sw", "southwest" as dir-sw.

A direction has a dirname.
A dirname has a direction called the realdir.
The dirname of north is dir-north. The realdir of dir-north is north.
The dirname of south is dir-south. The realdir of dir-south is south.
The dirname of east is dir-east. The realdir of dir-east is east.
The dirname of west is dir-west. The realdir of dir-west is west.
The dirname of northeast is dir-ne. The realdir of dir-ne is northeast.
The dirname of northwest is dir-nw. The realdir of dir-nw is northwest.
The dirname of southeast is dir-se. The realdir of dir-se is southeast.
The dirname of southwest is dir-sw. The realdir of dir-sw is southwest.

To decide what dirname is opposite-dir of (D - dirname):
if D is:
-- dir-north: decide on dir-south;
-- dir-south: decide on dir-north;
-- dir-east: decide on dir-west;
-- dir-west: decide on dir-east;
-- dir-ne: decide on dir-sw;
-- dir-nw: decide on dir-se;
-- dir-se: decide on dir-nw;
-- dir-sw: decide on dir-ne;
-- otherwise: decide on dir-none;

To say (D - dirname):
if D is:
-- dir-north: say "north";
-- dir-south: say "south";
-- dir-east: say "east";
-- dir-west: say "west";
-- dir-ne: say "northeast";
-- dir-nw: say "northwest";
-- dir-se: say "southeast";
-- dir-sw: say "southwest";
-- otherwise: say "(BUG)";

[Sometimes I have to print "an east door", "a north door", etc. This gets the article right.]
To say article (D - dirname):
if D is dir-east:
say "an east";
else:
say "a [D]";

Chapter - Go-Walls

[Most of the interesting code in this game is about the magic doors and walls. A go-wall is the wall kind. It stands in a particular direction and can accept a go-door. Go-walls come in pairs, obviously; the flopside property defines this.]

A go-wall is a kind of thing. A go-wall is usually scenery.
A go-wall has a dirname.
A go-wall has a go-wall called the flopside.
The printed name of a go-wall is usually "[dirname] wall".

The description of a go-wall is usually "It's a wall[door-extra-desc item described].";

Understand "wall" as a go-wall.
Understand "walls" as the plural of go-wall.
Understand the dirname property as describing a go-wall.

[Null reference for this kind.]
Not-a-wall is a go-wall.

Check entering a go-wall:
let D be the dirname of the noun;
if D is dir-none:
instead say "(BUG) [The noun] has no dirname.";
instead try going the realdir of D.


Chapter - Non-Walls

[A non-wall is a non-magical wall which stands in a particular direction. This lets us easily add scenery and customize the "You can't put a door there" and "You can't go that way" messages.]

A non-wall is a kind of thing. A non-wall is usually scenery.
A non-wall has a dirname.
The printed name of a non-wall is usually "[dirname] wall".
A non-wall has a text called the place-reason. The place-reason of a non-wall is usually "[The item described] [if plural-named]have[else]has[end if] no space for a door."
A non-wall has a text called the go-reason. The go-reason of a non-wall is usually "You can't walk through [the item described]."

Understand "wall" as a non-wall.
Understand the dirname property as describing a non-wall.

[Null reference for this kind.]
Not-a-non-wall is a non-wall.

Check entering a non-wall:
instead say "[go-reason of the noun][line break]"


Chapter - Go-Doors

[A go-door is a magic door. There are actually two instances for each "door", one for each side. The flipside property defines this. If one of the pair is emplaced ("linked") in a wall, the other is emplaced in the opposite wall. If the player is carrying one, the other is off-stage.]

A go-door is a kind of thing.
A go-door has a dirname.
A go-door has a text called the material. The material of a go-door is usually "wood".
A go-door has a text called the article-material. The material of a go-door is usually "a wood".
A go-door has a text called the gloss. The gloss of a go-door is usually "(BUG)".
A go-door has a go-door called the flipside.
A go-door can be enterable. A go-door is always enterable.
A go-door can be open or closed. A go-door is usually closed.
A go-door can be openable or unopenable. A go-door is usually openable.
A go-door can be locked or unlocked. A go-door is usually unlocked.
A go-door can be lockable. A go-door is usually lockable.
A go-door has a go-wall called the linked-wall.
A go-wall has a go-door called the linked-door.

Definition: A go-door is linked rather than unlinked if the linked-wall of it is not not-a-wall.
Definition: A go-wall is linked rather than unlinked if the linked-door of it is not not-a-door.

Understand "door", "wood", "wooden", "slab", "slab of" as a go-door.
Understand "doors" as the plural of go-door.
Understand the dirname property as describing a go-door.

[Null reference for this kind.]
Not-a-door is a go-door.

To say door-extra-desc (W - go-wall):
let D be the linked-door of W;
if D is not not-a-door:
say ". There is [article-material of D] door in it[if D is open], which is open[end if]";

Rule for writing a paragraph about a linked go-door (called D):
if D is open:
say "There is [article-material of D] door standing open to the [dirname of D].";
else:
say "There is [article-material of D] door to the [dirname of D]. It is closed.";

Check examining a go-door:
if the noun is unlinked:
if the noun is carried:
say "You hold [article dirname of noun] door in your hands";
else:
say "You see [article dirname of noun] door here, casually leaning, unattached to any wall";
instead say ". [gloss of noun].";
else:
instead say "[gloss of noun]. The [material of noun] door stands [if noun is open]open[else]closed[end if] in the [dirname of noun] wall."


Check closing an unlinked go-door:
if the noun is carried:
instead say "You can't close or open [the noun] while you're carrying it.";
instead say "Closing [the noun] doesn't make sense when it's just leaning there.";

Check opening an unlinked go-door:
if the noun is carried:
instead say "You can't open or close [the noun] while you're carrying it.";
instead say "Opening [the noun] doesn't make sense when it's just leaning there.";

Check opening a locked go-door:
if the noun is unknown:
now the noun is known;
instead say "You find that [the noun] is locked.";
else:
instead say "[The noun] is locked.";

Carry out opening a go-door:
now the noun is open;
now the flipside of the noun is open;

Carry out closing a go-door:
now the noun is closed;
now the flipside of the noun is closed;

Check locking a go-door with:
if the second noun is not a key:
instead say "That isn't a key.";
instead say "[The noun] doesn't have any keyhole.";

Check unlocking a go-door with:
if the second noun is not a key:
instead say "That isn't a key.";
instead say "[The noun] doesn't have any keyhole.";

Check taking an open go-door:
now the noun is closed;
now the flipside of the noun is closed;
say "(first closing [the noun])";

Check taking a locked go-door:
if the noun is unknown:
now the noun is known;
instead say "You try to take [the noun], but discover that it is locked.";
else:
instead say "You can't take [the noun] -- it's locked.";

Carry out taking a go-door:
let OD be the flipside of the noun;
let W be the linked-wall of the noun;
let OW be the linked-wall of OD;
now the noun is closed;
now OD is closed;
now previously-linked is the linked-wall of the noun;
now the linked-wall of the noun is not-a-wall;
now the linked-wall of OD is not-a-wall;
now the linked-door of W is not-a-door;
now the linked-door of OW is not-a-door;
now the player carries the noun;
now OD is off-stage;

Report taking a go-door:
if the previously-linked is not not-a-wall:
instead say "You remove [the noun] from [the previously-linked][first time]. Now the wall is doorless[only].";
else:
instead say "It's a door, but you take it.";

Check dropping a carried go-door:
let D be the dirname of the noun;
let W be the wall-facing D from the location;
if W is not-a-wall:
let NW be the non-wall-facing D from the location;
if NW is not-a-non-wall:
instead say "There is no [D] wall to put [the noun] on.";
else:
instead try putting the noun on NW;
if the linked-door of W is not not-a-door:
instead say "[The W] already has [a linked-door of W] in it.";
let OD be the flipside of the noun;
let OW be the flopside of W;
if OW is not-a-wall:
instead say "(BUG) There is no flopside of [W].";
now the noun is in the holder of W;
now the linked-wall of the noun is W;
now the linked-door of W is the noun;
now OD is in the holder of OW;
now the linked-wall of OD is OW;
now the linked-door of OW is OD;
instead say "You place [the noun] on [the W][first time]. Now [the W] has a door in it. The door is closed.[para]You feel like this ought to make less sense than it does[only].";

Check inserting a go-door into a go-wall:
instead try putting the noun on the second noun.

Check putting a go-door on a go-wall:
if the linked-wall of the noun is the second noun:
instead say "[The noun] is already on [the second noun].";
if the noun is not carried:
say "(first taking [the noun])[command clarification break]";
silently try taking the noun;
if the noun is not carried:
stop the action;
if the dirname of the noun is not the dirname of the second noun:
instead say "You can't put [a noun] on [article dirname of the second noun] wall.";
instead try dropping the noun;

Check inserting a go-door into a non-wall:
instead try putting the noun on the second noun.

Check putting a go-door on a non-wall:
instead say "[place-reason of the second noun][line break]";

Check turning a go-door:
if the noun is unlinked:
instead say "You turn [the noun] around [if the noun is carried]in your hands[else]in place[end if], but it's still [article dirname of noun] door.";
instead say "You can't.";

Check entering an unlinked go-door:
if the noun is carried:
instead say "You can't go through a door that you're carrying!";
instead say "There's no through. [The noun] is just leaning there.";

Check entering a go-door:
if the holder of the noun is not the location:
instead say "(BUG) [The noun] is not in the location.";
let W be the linked-wall of the noun;
if W is not-a-wall:
instead say "(BUG) [The noun] is not attached to a wall.";
if the dirname of W is not the dirname of the noun:
instead say "(BUG) [The noun] has a dirname mismatch with [W].";
let dir be the realdir of the dirname of W;
instead try transiting dir through W.

Chapter - Keys

The brass-key is a key. The printed name is "brass key".
Understand "brass", "brassy", "key", "housekey" as the brass-key.
The description is "Totally ordinary brass housekey[first time]. It's definitely not yours, though[only]."

Check turning the brass-key:
instead say "You turn the brass key exaggeratedly in mid-air[first time], in case this is something which will magically help. It doesn't help. Worth a try, though[only]."

Check smelling the brass-key:
instead say "You love the smell of handled brass."

The old-key is a key. The printed name is "old key".
Understand "old", "old-fashioned", "fashioned", "long", "iron", "key" as the old-key.
The description is "It's an old-fashioned long iron key."

The old-key is in room-E.

Check smelling the old-key:
instead say "It smells faintly rusty."


Chapter - The Map Index

A room has a number called the index. The index of a room is usually -1.

The description of a room is usually "This is room [index]."

[Null reference for this kind.]
No-room is a room.

[We store the map as a one-dimensional array, because Inform doesn't have two-dimensional arrays. Okay, I could have used a list of lists, but this is easy enough to manage.]
The map-index is a list of rooms that varies. The map-index is { no-room, no-room, no-room, no-room, no-room, no-room, no-room, no-room, no-room, no-room, no-room, no-room, no-room, no-room, no-room }.

[Fill in the map-index array, which is defined with 15 entries. (A 3x5 grid.)]
When play begins:
repeat with R running through rooms:
let N be the index of R;
if N >= 0 and N < 15:
now entry (N + 1) of map-index is R;

To decide what room is room-indexed (N - number):
if N < 0 or N >= 15:
decide on no-room;
else:
decide on entry (N + 1) of map-index;

To decide what number is move (D - dirname) from (R - room):
let N be the index of R;
if N < 0 or N >= 15:
say "(BUG) move [D] from [R]: bad room.";
decide on -1;
decide on move D from N;

[This is the code that lets us use the map-index array as a 3x5 grid. Apply the appropriate offset to move from one index to another. This does *not* check for edges or out-of-bound conditions. The caller must check that the return value is between 0 and 14 (inclusive).]
To decide what number is move (D - dirname) from (N - number):
if D is:
-- dir-north: decide on N - 5;
-- dir-south: decide on N + 5;
-- dir-east: decide on N + 1;
-- dir-west: decide on N - 1;
-- dir-ne: decide on N - 4;
-- dir-nw: decide on N - 6;
-- dir-se: decide on N + 6;
-- dir-sw: decide on N + 4;
-- otherwise:
say "(BUG) move [D]: dirname not recognized.";
decide on -1.

To decide what go-wall is wall-facing (D - dirname) from (R - room):
repeat with W running through go-walls in R:
if the dirname of W is D:
decide on W;
decide on not-a-wall.

To decide what non-wall is non-wall-facing (D - dirname) from (R - room):
repeat with W running through non-walls in R:
if the dirname of W is D:
decide on W;
decide on not-a-non-wall.

Definition: a room is doorless:
repeat with W running through go-walls in it:
if W is linked:
decide no;
decide yes.

Chapter - Movement

Instead of going when the dirname of noun is not dir-none:
let D be the dirname of noun;
let W be wall-facing D from the location;
if W is not-a-wall:
let NW be non-wall-facing D from the location;
if NW is not not-a-non-wall:
instead try entering NW;
continue the action;
instead try transiting the noun through W.

[The transiting action is used internally. The player can't invoke it directly.]
Transiting it through is an action applying to two visible things. [...a direction and a go-wall.]

Carry out transiting:
let D be the dirname of the noun;
if D is dir-none:
instead say "(BUG) Transit: null dirname.";
let W be the second noun;
if W is not a go-wall:
instead say "(BUG) Transit: [W] is not a wall.";
if W is not-a-wall:
instead say "(BUG) Transit: [W] is not-a-wall.";
if the dirname of W is not D:
instead say "(BUG) Transit: dirname of [W] is not [D].";
let OW be the flopside of W;
let R be the holder of OW;
if R is not a room:
instead say "(BUG) Transit: other wall [OW] is not in a room.";
if W is unlinked:
instead say "You can't walk through [the W].";
let P be the linked-door of W;
if P is closed:
say "(first opening [the P])[command clarification break]";
silently try opening P;
if P is closed:
stop the action;
say "You walk through [the P].";
move the player to the holder of OW.

Chapter - The Map

[Now we define all the rooms.]

When play begins:
say "'City of Doors?' you shout, leaping through. 'If I never see another door as long as I live, it'll be six weeks too soon!'[para]Then you look around. Whoops. Maybe you shouldn't have been so emphatic.";

Section - Room A

Room-A is a room. The index of it is 7.
The printed name of Room-A is "The Study".
The description is "You are standing in someone's fusty study. It might have been someone's a decade ago, anyway. The writing desk has been cleaned out, the fireplace is scraped, and the bookshelves on the north wall are bare[Room-A-extra]."

To say Room-A-extra:
if Room-A is doorless:
say ".[para]The west, south, and east walls are bare as well. Notably, they are bare of doors. The room has no exits whatsoever";
let N be the number of go-doors carried by the player;
if N > 0:
say ". Except the [if N is 1]one[else]ones[end if] in your hands";
else:
if there is an unlinked go-wall (called W) in Room-A:
let N be the number of unlinked go-walls in Room-A;
if N is 1:
say ".[para][The W] is bare";
else:
say ".[para][The list of unlinked go-walls in Room-A] are bare";

The bookshelves are a plural-named non-wall in Room-A. The dirname of the bookshelves is dir-north.
Understand "bookshelf", "book", "books", "shelf", "shelves" as the bookshelves.
The place-reason of the bookshelves is "The north wall is entirely covered with bookshelves. There's no space to put a door."
The go-reason of the bookshelves is "You can't walk through the bookshelves."

Check examining the bookshelves:
increment the counter of Room-A;
instead say "The shelves may have once held the high histories of the planes. They may once have held searing tales of adventure and the heart. They may once have held volumes 201 through 350 of a cabbage factor's shipping ledger. Now they are empty of all these things."

Check searching the bookshelves:
increment the counter of Room-A;
instead say "You look over the shelves [one of]again[or]one more time[stopping]. Still no books."

Check pushing the bookshelves:
instead say "No trick passages here[first time], alas[only]."

Check pulling the bookshelves:
instead try pushing the bookshelves.
Check taking the bookshelves:
instead try pushing the bookshelves.

The description of the wall-A-e is "The east wall is painted a faded green[door-extra-desc item described]."
The description of the wall-A-w is "The west wall is painted a faded green[door-extra-desc item described]."
The description of the wall-A-s is "The south wall is painted a stained and faded green[door-extra-desc item described]."

The ceiling-A is scenery in Room-A. The printed name is "ceiling".
Understand "plaster", "ceiling" as ceiling-A.
The description of ceiling-A is "The ceiling is unadorned but for the marks of the plasterer who made it[one of][or]. You're not sure how the light is getting in, come to think of it[or][stopping]."

Check entering the ceiling-A:
instead say "There's no way up."

Check going up in Room-A:
instead say "There's no way up."

The writing-desk is a scenery supporter in Room-A. The printed name is "writing desk".
Understand "desk", "writing", "niche", "niches", "gap" as the writing-desk.

Check examining the writing-desk:
increment the counter of Room-A;
instead say "The desk is a fancy little affair -- clearly the furnishing of the room that someone loved best. It has little niches for letters and a gap for an inkwell. Its paint is worn by the touch of a hand. But, like a mute raven, all its notes are gone[if the brass-key is in Room-A and the brass-key is not handled].[para]A brass key rests on the desk[end if]."

Check searching the writing-desk:
instead try examining the writing-desk.

Check pushing the writing-desk:
instead say "The desk isn't quite small enough to be easily moved."

Check pulling the writing-desk:
instead try pushing the writing-desk.
Check taking the writing-desk:
instead try pushing the writing-desk.

Check putting a go-door on the writing-desk:
instead say "The desk is too small to support a door."
Check inserting a go-door into the writing-desk:
instead say "The desk is too small to support a door."

The brass-key is in Room-A.

Check examining the brass-key:
increment the counter of Room-A;

Rule for writing a paragraph about the not handled brass-key:
say "[if the door-E-oak is not handled]For that extra salt of irony, a brassy key[else]A brassy key[end if] rests in the center of the desk."

The fireplace is scenery in Room-A.
Check examining the fireplace:
increment the counter of Room-A;
instead say "A narrow fireplace huddles in a corner, just big enough to warm the room, if the room were cold. (In fact it's a bit sweaty in here.) Like everything else, the fireplace hasn't been used in a long time."

Check searching the fireplace:
increment the counter of Room-A;
instead say "The flue is barely wide enough for your fist. You can't see light coming down, anyhow."

Check entering the fireplace:
instead try searching the fireplace.

Check inserting into the fireplace:
instead say "Don't bother."

Check waiting when the location is Room-A:
now the timer of Room-A is 0;
increase the counter of Room-A by 5.

The timer of Room-A is 1.

Every turn when the location is Room-A and Room-A is not whispered and the counter of Room-A >= 3:
if the timer of Room-A > 0:
decrement the timer of Room-A;
else:
now Room-A is whispered;
now the player carries door-e-oak;
say "A voice by your ear murmurs, 'You're late.' You whirl, but you are alone.[para]'Too late by years. They've already taken all the doors.' The voice is coming from the fireplace now. 'Or were you after some sort of treasure? More fool you.' Now from somewhere near the bookshelves, except there's nothing there either.[para]You grit your teeth and turn a slow circle; still nothing. 'Well,' says the voice regardless, 'I'd hate for you to just die of thirst. Tedious for everyone involved. Take this.'[para]You spin the other way and almost crack your head on heavy wood. You stagger back with a slab of oak in your hands.";

Section - Room B

Room-B is a room. The index of it is 8.
The printed name of Room-B is "An Octagonal Room".
The description is "This spacious chamber has eight sides and an elaborately tiled floor. The walls to the northwest, northeast, southwest, and east are hung with tapestries. The other four tapestries have been torn away, leaving only bare walls and tatters."

The floor-B is scenery in Room-B. The printed name is "floor".
Understand "floor", "tile", "tiles", "tiled", "tessera", "tesserae", "cracked", "gray", "grey", "gold", "white", "spiral" as the floor-B.
The description is "Grey, white, and gold tesserae spiral inward from the walls. Towards the center of the floor, the tiles are cracked and ground away."

Check entering floor-B:
instead try going down.

Check going down in Room-B:
instead say "The floor is battered but solid. There's no way down."

The description of the wall-B-w is "The tapestry to the west is gone, leaving a [if item described is unlinked]bare [end if]wall[door-extra-desc item described].";

The description of the wall-B-se is "The tapestry to the southeast is gone, leaving a [if item described is unlinked]bare [end if]wall[door-extra-desc item described].";

The description of the wall-B-n is "The tapestry to the north is gone, leaving a [if item described is unlinked]bare [end if]wall[door-extra-desc item described].";

Understand "chalk", "arch", "archway" as the wall-B-n when the wall-B-n is unlinked.

Check examining the unlinked wall-B-n:
instead say "The tapestry to the north is gone, leaving a bare wall. A crude arch shape is scrawled in chalk on it.";

Check rubbing the unlinked wall-B-n:
instead say "The chalk smears a bit.";

The description of the wall-B-s is "The tapestry to the south is gone, leaving a [if item described is unlinked]bare [end if]wall[door-extra-desc item described].";

Understand "chalk", "word", "words" as the wall-B-s when the wall-B-s is unlinked.

Check examining the unlinked wall-B-s:
instead say "The tapestry to the south is gone, leaving a bare wall. Scrawled on it are words in chalk: 'THEY STOLE THE DOORS'.";

Check rubbing the unlinked wall-B-s:
instead say "The chalk smears a bit.";

Report taking a go-door when the previously-linked is the wall-B-s:
instead say "You remove the south pine door from the south wall. Revealed on the blank wall behind it, you read words scrawled in chalk: 'THEY STOLE THE DOORS'."

A tapestry is a kind of non-wall. The printed name is usually "[dirname] tapestry".
Understand "tapestry", "arras", "hanging" as a tapestry.
Understand "tapestries" as the plural of tapestry.

Check examining a tapestry:
increment the counter of Room-B.

Check taking a tapestry:
instead say "The remaining tapestries are firmly affixed."

Check pulling a tapestry:
instead try taking the noun.
Check pushing a tapestry:
instead try taking the noun.

The tapestry-nw is a tapestry in Room-B. The dirname of tapestry-nw is dir-nw.
The tapestry-ne is a tapestry in Room-B. The dirname of tapestry-ne is dir-ne.
The tapestry-sw is a tapestry in Room-B. The dirname of tapestry-sw is dir-sw.
The tapestry-east is a tapestry in Room-B. The dirname of tapestry-east is dir-east.

The description of tapestry-nw is "The northwest tapestry shows a gathering of elegant gentlefolk in an elegant ballroom. Skirts whirl and tailcoats swing in the dance. But outside, seen through the tall windows, flames rise against the night."

The description of tapestry-sw is "The southwest tapestry shows a castle of golden stone on a distant hill. Dark tents are encamped at the wall; they wreath the scene in dirty smoke. Oddly, the castle seems to have no front gate or door."

The description of tapestry-east is "The eastern tapestry shows a ballroom in disarray. Servants carry hastily-packed bags through the room, pursued by battered soldiers. The walls are bare and windowless."

The description of tapestry-ne is "The northeast tapestry shows a high tower of golden stone silhouetted by a setting sun. The tower has neither door nor window, and no banner flies above it."

The timer of Room-B is 1.

Every turn when Room-B is not whispered and the counter of Room-B >= 4:
if the timer of Room-B > 0:
decrement the timer of Room-B;
else:
now Room-B is whispered;
say "A voice by your ear murmurs, 'I never liked them, you know.'";

Section - Room C

Room-C is a room. The index of it is 13.
The printed name of Room-C is "The Shattered Salon".

The description is "This was once a dignified salon. Now the tea-tables are shoved to the walls and the floor is littered with broken crockery. The south side of the room is barricaded by barrels stacked ceiling-high[Room-C-extra]."

To say Room-C-extra:
if there is an unlinked go-wall (called W) in Room-C:
let N be the number of unlinked go-walls in Room-C;
if N is 1:
say ".[para][The W] contains only peeling wallpaper";
else if N is 3:
say ".[para]The east, west, and north walls contain only peeling wallpaper. There are no exits";
else:
say ".[para][The list of unlinked go-walls in Room-C] contain only peeling wallpaper";

The crockery is scenery in Room-C.
Understand "broken", "shattered", "smashed", "shard", "shards", "tea", "teapot", "teapots", "pot", "pots", "teacup", "teacups", "cup", "cups" as the crockery.
The description of the crockery is "Teapots have fallen and smashed, or perhaps been flung in futile defense."

Check taking the crockery:
instead say "The crockery is all smashed to uselessness."

Check searching the crockery:
instead say "You sift through some of the shards, but there's nothing here worth considering."

Check pulling the crockery:
instead try searching the crockery.
Check pushing the crockery:
instead try searching the crockery.

The tea-tables are plural-named scenery in Room-C.
Understand "tea", "table", "tables" as the tea-tables.
The description is "There's not much to the tables now."

The barrels are a plural-named non-wall in Room-C. The dirname of the barrels is dir-south.
Understand "stacked", "stack", "stacks", "barrel", "cask", "casks", "barricade" as the barrels.
The printed name is "stacked barrels".
The description is "Barrels have been stacked to the south, forming an impromptu but entirely effective barricade. You peer closer and notice that the barrels are stamped with tea export notices."

Check taking the barrels:
instead say "The stacks of barrels are much too heavy to move[one of][or]. Indeed, each individual barrel is much too heavy to move[or][stopping]."

Check pushing the barrels:
instead try taking the barrels;
Check pulling the barrels:
instead try taking the barrels;

Check opening the barrels:
instead say "The tops are sealed down tight."

Check smelling the barrels:
instead say "The barrels smell rather pleasantly of old tea."

Understand "wallpaper", "paper", "peeling", "roses" as the wall-C-w.
Understand "wallpaper", "paper", "peeling", "roses" as the wall-C-e.
Understand "wallpaper", "paper", "peeling", "thorns" as the wall-C-n.

The description of the wall-C-e is "Peeling paper with a pattern of roses covers the east wall[door-extra-desc item described]."
The description of the wall-C-w is "Peeling paper with a pattern of roses covers the west wall[door-extra-desc item described]."
The description of the wall-C-n is "Peeling paper with a pattern of thorns covers the north wall[door-extra-desc item described]."

The timer of Room-C is 6.

Every turn when Room-C is not whispered and the location is Room-C and door-e-ash is handled:
if the timer of Room-C > 0:
decrement the timer of Room-C;
if the timer of Room-C is:
-- 4: say "The voice murmurs, 'This is not how it was supposed to end.'";
-- 2: say "The voice murmurs, 'The doors should have been enough. But look what's left now.'";
else:
now Room-C is whispered;
say "The voice murmurs, 'Why did I even....'";

Section - Room D

Room-D is a room. The index of it is 12.
The printed name of Room-D is "The Hung Garden".
The description is "You [one of]step out into[or]are in[stopping] a garden built on the shoulder of a high edifice. Stone walls stand to the north and east, partially enclosing this space. To the south and west, you look down across a landscape of scrubby hills.[para]The garden itself is worn down with neglect. Dry soil and dry leaves spill wind-blown from the bare beds. A few brown vines cling stubbornly to trellises."

Check going up in Room-D:
instead say "You can't climb the castle walls."

Check going down in Room-D:
instead say "The stone walls form a sheer drop below the garden, several stories down to the ground. You can't descend[one of][or]. At least not in any form that could walk away from the landing[or][stopping].";

Check climbing wall-D-n:
instead try going up.
Check climbing wall-D-e:
instead try going up.

Check going southwest in Room-D:
instead try going down.
Check going west in Room-D:
instead try going down.
Check going south in Room-D:
instead try going down.
Check going southeast in Room-D:
instead try going down.
Check going northwest in Room-D:
instead try going down.

Rule for writing a paragraph about the unlinked not handled door-e-ash:
say "[A door-e-ash], unattached to any wall, is leaning against a trellis in the middle of the garden.";

The garden is scenery in Room-D.
Understand "bed", "beds", "vine", "vines", "trellis", "trellises", "weed", "weeds", "plant", "plants", "brown", "stubborn", "dry", "soil", "dirt", "earth", "leaf", "leaves" as the garden.
The description is "Flowers must once have poured from the trellises and spilled across the garden beds. Now you see only weeds and a few stubborn vines."

Check climbing the garden:
instead say "The trellises aren't that high."

Check taking the garden:
instead say "There's nothing in the garden worth picking[if door-e-ash is in Room-D and door-e-ash is not handled], except that [door-e-ash][end if]."

Check pulling the garden:
instead try taking the garden.

Check smelling the garden:
instead say "The vines cling tenaciously to the world, and smell of it."

The landscape-D is scenery in Room-D. The printed name is "landscape".
Understand "hill", "hills", "scrub", "scrubby", "dry", "live", "oak", "live-oak" as the landscape-D.

Check examining the landscape-D:
increment the counter of Room-D;
instead say "Long afternoon shadows spill across a landscape of dry hills and scrubby live-oak. You can see no other sign of habitation -- not even a road running from this place."

Instead of doing anything except examining to the landscape-D:
instead say "The hills are below and far to the southwest."

The castle-D is scenery in Room-D. The printed name is "edifice".
Understand "castle", "edifice", "high" as castle-D.
The description of castle-D is "High as you are, the castle towers even higher above you."

Check climbing the castle-D:
instead try going up.

Check entering the castle-D:
instead say "The edifice stands to the north and east."

The timer of Room-D is 1.

Every turn when Room-D is not whispered and the location is Room-D and the counter of Room-D >= 1:
if the timer of Room-D > 0:
decrement the timer of Room-D;
else:
now Room-D is whispered;
say "The voice murmurs, 'This country was alive, once. But the road went with the castle doors, and the villages went with the road. The river...' There is a pause. 'I never discovered where the river went. Perhaps you will.'";

Section - Room E

Room-E is a room. The index of it is 14.
The printed name of Room-E is "A Collapsing Corner".
The description is "This was once a high vault of chilly brown brick. Now only the west and northwest walls remain intact. The rest of the room is lost under slumping piles of loose bricks.[para]An erratic boulder stands proud amid the broken brickwork[if old-key is in Room-E and old-key is not handled]. You notice [an old-key] lying next to the boulder[end if]."

Understand "plain", "brown", "brick" as the wall-E-w.
Understand "plain", "brown", "brick" as the wall-E-nw.

The description of the wall-E-w is "The west wall is plain brown brick[door-extra-desc item described]."
The description of the wall-E-nw is "The northwest wall is plain brown brick[door-extra-desc item described]."

Check going southeast in Room-E:
instead say "The fallen bricks make that part of the room impassable."
Check going south in Room-E:
instead try going southeast.
Check going east in Room-E:
instead try going southeast.
Check going north in Room-E:
instead try going southeast.
Check going northeast in Room-E:
instead try going southeast.
Check going southwest in Room-E:
instead try going southeast.

The boulder is scenery in Room-E.
Understand "erratic", "mass", "rock", "stone", "granite" as the boulder.
The description is "The mass of granite stands amid the piles of bricks, as if it had just finished smashing its way into the room. It shows no hint of movement just now -- but you're keeping an eye on it."

Check taking the boulder:
instead say "The erratic boulder is solid granite, shoulder-high. [one of]You're[or]It may move if it feels like moving, but you're[or]You're[stopping] not moving it."

Check pushing the boulder:
instead try taking the boulder.
Check pulling the boulder:
instead try taking the boulder.

Check touching the boulder:
instead say "The boulder retains a faint hint of sunlit warmth."

Check looking under the boulder:
instead say "There's really no way to."

The brick-piles are plural-named scenery in Room-E. The printed name is "piles of bricks".
Understand "brown", "brick", "bricks", "brickwork", "pile", "piles", "piles of", "slumping", "loose", "broken", "fallen" as the brick-piles.

Check taking the brick-piles:
instead say "It would take you a year to excavate the fallen brickwork."

Check pushing the brick-piles:
instead try taking the brick-piles.
Check pulling the brick-piles:
instead try taking the brick-piles.

Check entering the brick-piles:
instead say "You can't get through the fallen bricks."

Check smelling the brick-piles:
instead say "You smell only a fading trace of shocked dust."

Check looking under the brick-piles:
instead say "You find additional bricks. A brick surplus, really."

Section - Room F

Room-F is a room. The index of it is 6.
The printed name of Room-F is "The Waterworks".
The description is "Eight cavernous sewer pipes run into this dim chamber. A platform of metal grate supports your weight -- barely -- above their intersection.[para]Leaden walls have descended to the east and northwest, sealing off those two pipes. From the other six directions, torrents of water pour into the chamber and fall into the maelstrom below your feet."

Check going down in Room-F:
instead say "Sure, you could jump off the platform. Survive the churning maelstrom, no."

The description of the wall-F-nw is "A heavy leaden wall blocks the northwest pipe[door-extra-desc item described]."
The description of the wall-F-e is "A heavy leaden wall blocks the east pipe[door-extra-desc item described]."

Understand "lead", "leaden", "heavy" as the wall-F-nw.
Understand "lead", "leaden", "heavy" as the wall-F-e.

A sewer-pipe is a kind of non-wall. The printed name is usually "[dirname] pipe".
Understand "pipe", "sewer", "cavernous" as a sewer-pipe.
Understand "pipes" as the plural of sewer-pipe.

The description of a sewer-pipe is usually "The pipe runs to the [dirname] as far as you can see, although that isn't far in this gloom. Water roars down the pipe towards you, falls past the edge of the platform, and swirls into the darkness below."
The go-reason of a sewer-pipe is usually "The platform doesn't extend into the pipes, and you couldn't possibly swim upstream through the torrent."
The place-reason of a sewer-pipe is usually "The door is much too small for the mouth of [the item described]."

The sewer-pipe-n is a sewer-pipe in Room-F. The dirname of sewer-pipe-n is dir-north.
The sewer-pipe-ne is a sewer-pipe in Room-F. The dirname of sewer-pipe-ne is dir-ne.
The sewer-pipe-se is a sewer-pipe in Room-F. The dirname of sewer-pipe-se is dir-se.
The sewer-pipe-s is a sewer-pipe in Room-F. The dirname of sewer-pipe-s is dir-south.
The sewer-pipe-sw is a sewer-pipe in Room-F. The dirname of sewer-pipe-sw is dir-sw.
The sewer-pipe-w is a sewer-pipe in Room-F. The dirname of sewer-pipe-w is dir-west.

The metal-platform is scenery in Room-F. The printed name is "platform".
Understand "metal", "grate", "grating", "platform", "octagon", "octagonal" as the metal-platform.
The description is "An octagon of metal grate is suspended above the maelstrom."

Check putting something on the metal-platform:
instead try dropping the noun.
Check inserting something into the metal-platform:
instead try dropping the noun.

Check taking the metal-platform:
instead say "That's hardly portable, and besides, you're standing on it."

Check entering the metal-platform:
instead say "You're already standing on the platform."

Check getting off the metal-platform:
instead try going down.

The maelstrom is scenery in Room-F.
Understand "water", "whirling", "whirlpool", "churning", "torrent", "torrents", "flood" as the maelstrom.
The description is "Water pours into the room from six directions and plummets into a churning whirlpool. Somewhere below it must drain into an outlet, but you can only see the maelstrom."

Check entering the maelstrom:
instead try going down.

Check smelling the maelstrom:
instead say "It smells of the world before the flood."

The timer of Room-F is 1.

Every turn when Room-F is not whispered and the location is Room-F and door-nw-ebony is unlocked:
if the timer of Room-F > 0:
decrement the timer of Room-F;
else:
now Room-F is whispered;
say "The voice mutters in your ear, 'Anyone could knock, do you see? Every door in its place, every face in its window. I made them [em]perfectly[/em].' The tone has turned sullen.";

Section - Room G

Room-G is a room. The index of it is 0.
The printed name of Room-G is "A Balcony".
The description is "A vast and starry sky surrounds this balcony, which clings to the northwest side of a stone edifice. A very long way below, dimly-lit hills roll away from the castle's feet."

The printed name of the wall-G-se is "castle wall".
Understand "edifice", "castle", "stone" as the wall-G-se.

Check examining wall-G-se:
say "The stone edifice would seem enormous if it were not silhouetted against an even larger night sky. It's hard to tell in the darkness, but it seems as if the stone wall is entirely featureless. There's not a window or even a loose stone protruding -- except for this balcony";
let D be the linked-door of wall-G-se;
if D is not not-a-door:
say " and the [if D is open]open[else]closed[end if] [D]";
instead say "."

Check climbing the wall-G-se:
instead try going up.

Check going down in Room-G:
instead say "There's no[one of][or] survivable[or][stopping] way down."

Check going up in Room-G:
instead say "You can't climb the castle wall."

Check going northwest in Room-G:
say "The only way off the balcony is back to the southeast";
if wall-G-se is unlinked:
say ", and that wall is currently doorless";
instead say "."
Check going north in Room-G:
instead try going northwest.
Check going south in Room-G:
instead try going northwest.
Check going east in Room-G:
instead try going northwest.
Check going west in Room-G:
instead try going northwest.
Check going northeast in Room-G:
instead try going northwest.
Check going southwest in Room-G:
instead try going northwest.

The wall-token-nw is scenery in Room-G. The printed name is "so-called northwest wall".
Understand "nw", "northwest", "wall" as wall-token-nw.

Instead of doing anything to wall-token-nw:
instead say "It's the northwest wall of the edifice, but from your point of view, it's a southeast wall."

Check putting something on the wall-token-nw:
instead try touching the wall-token-nw.
Check inserting something into the wall-token-nw:
instead try touching the wall-token-nw.

Does the player mean doing something to wall-token-nw:
it is very unlikely.

The landscape-G is scenery in Room-G. The printed name is "landscape".
Understand "hill", "hills", "scrub", "scrubby", "dry", "live", "oak", "live-oak" as the landscape-G.

Check examining the landscape-G:
instead say "Stars peer down on a landscape of dry hills and scrubby live-oak. You can see no other sign of habitation -- not even a road running from this place."

Instead of doing anything except examining to the landscape-G:
instead say "The hills are below and to the northwest."

The sky-G is scenery in Room-G. The printed name is "sky".
Understand "sky", "night", "star", "starry", "stars", "darkness", "vast" as the sky-G.
The description is "The stars are many but cast a distant light."

Instead of doing anything except examining to the sky-G:
instead say "The sky is beyond your reach."

Section - Room H

Room-H is a room. The index of it is 3.
The printed name of Room-H is "The Exit".
The description is "This small square chamber might have been a closet. Sunlight bleeds in through walls of cracked, mossy stone. Only the south wall is solid enough to support a door[if wall-H-s is unlinked], although there's no door there now[end if].[para]In the center of the room is a portal, a free-standing arch. You can see a silvery astral haze within its span -- nothing more."

The description of the wall-H-s is "It's a solid stone wall[door-extra-desc item described]."
Understand "solid", "stone" as wall-H-s.

A closet-wall is a kind of non-wall.
Understand "stone", "cracked", "crack", "cracks", "crumbling", "crumbly", "mossy", "wall" as a closet-wall.
Understand "walls" as the plural of closet-wall.
The description of a closet-wall is usually "[The item described] is a crumbling mass of stone, barely solid enough to be called a wall. Daylight filters through the cracks."

The place-reason of a closet-wall is usually "[The item described] is too badly damaged to support a door."
The go-reason of a closet-wall is usually "[The item described] is cracked, but you can't just walk through it."

Check pushing a closet-wall:
instead say "The stone doesn't shift[first time]. Apparently there's a lot of ruin left to go before this place collapses entirely[only]."

The closet-wall-n is a closet-wall in Room-H. The dirname of closet-wall-n is dir-north.
The closet-wall-e is a closet-wall in Room-H. The dirname of closet-wall-e is dir-east.
The closet-wall-w is a closet-wall in Room-H. The dirname of closet-wall-w is dir-west.

The arch is scenery in Room-H.
Understand "portal", "free", "standing", "free-standing", "exit", "span", "silver", "silvery", "astral", "haze", "planar", "transplanar" as the arch.
The description is "It's a transplanar portal. It looks just like one."

Check searching the arch:
instead say "You can't see what's on the other side of the arch."

Instead of doing anything to the arch when Room-H is whispered and the timer of Room-H > 1:
instead say "The arch is vibrating painfully. You can't get near it.";

Check entering the arch:
if Room-H is not whispered:
now Room-H is whispered;
instead say "A violent sonic shock knocks you back across the floor.";
else:
if the timer of Room-H > 1:
instead say "The arch is vibrating painfully. You can't get near it.";
else:
say "You step through the arch and pass from this place.";
end the story finally saying "Onward";
stop the action.

Check exiting in Room-H:
instead try entering the arch.
Check going outside in Room-H:
instead try entering the arch.
Check going inside in Room-H:
instead try entering the arch.

The closet-light is scenery in Room-H. The printed name is "sunlight".
Understand "light", "sunlight", "daylight", "sliver", "slivers" as the closet-light.
The description is "It must be bright day outside this room. You can't get a clear view, but slivers of light filter in between the cracked stones, here and there."

Instead of doing anything except examining to the closet-light:
instead say "You can see the light; you can't touch the light."

The closet-moss is scenery in Room-H. The printed name is "moss".
Understand "moss", "fluff", "fluffy", "green" as the closet-moss.
The description is "Fluffy green moss straggles in between the stones, following the sunlight."

Check taking the closet-moss:
instead say "You have no use for moss."

Check pulling the closet-moss:
instead try taking the closet-moss.

Check touching the closet-moss:
instead say "It's scratchier than it looks."

Check rubbing the closet-moss:
instead try touching the closet-moss.

The timer of Room-H is 4.

Every turn when Room-H is whispered and the location is Room-H:
if the timer of Room-H is:
-- 4:
decrement the timer of Room-H;
say "The voice snaps, 'Do you think I've forgiven them?'";
-- 3:
decrement the timer of Room-H;
say "The voice goes soft again. 'I apologize. I shouldn't take this out on you, should I?'[para]'The folk who lived here should have trusted me,' the voice continues from behind you. 'They should have trusted my doors.'";
-- 2:
decrement the timer of Room-H;
say "The voice murmurs, 'You've taken a few of my doors now. The rest were... well. You know.' The sonic vibrations fade from the arch. 'You should go. There's nothing left here.'";
-- 1:
decrement the timer of Room-H;
say "The room is still now, but for the swirling of the portal's haze.";
-- 0:
do nothing;


Section - Walls

[This section defines the position and flopside of each wall. To avoid careless inconsistencies (and tedium), I generated these lines using a small Python script.]

The wall-A-e is a go-wall in Room-A. The flopside of wall-A-e is the wall-B-w. The dirname of wall-A-e is dir-east.
The wall-B-w is a go-wall in Room-B. The flopside of wall-B-w is the wall-A-e. The dirname of wall-B-w is dir-west.

The wall-B-s is a go-wall in Room-B. The flopside of wall-B-s is the wall-C-n. The dirname of wall-B-s is dir-south.
The wall-C-n is a go-wall in Room-C. The flopside of wall-C-n is the wall-B-s. The dirname of wall-C-n is dir-north.

The wall-A-s is a go-wall in Room-A. The flopside of wall-A-s is the wall-D-n. The dirname of wall-A-s is dir-south.
The wall-D-n is a go-wall in Room-D. The flopside of wall-D-n is the wall-A-s. The dirname of wall-D-n is dir-north.

The wall-D-e is a go-wall in Room-D. The flopside of wall-D-e is the wall-C-w. The dirname of wall-D-e is dir-east.
The wall-C-w is a go-wall in Room-C. The flopside of wall-C-w is the wall-D-e. The dirname of wall-C-w is dir-west.

The wall-C-e is a go-wall in Room-C. The flopside of wall-C-e is the wall-E-w. The dirname of wall-C-e is dir-east.
The wall-E-w is a go-wall in Room-E. The flopside of wall-E-w is the wall-C-e. The dirname of wall-E-w is dir-west.

The wall-B-se is a go-wall in Room-B. The flopside of wall-B-se is the wall-E-nw. The dirname of wall-B-se is dir-se.
The wall-E-nw is a go-wall in Room-E. The flopside of wall-E-nw is the wall-B-se. The dirname of wall-E-nw is dir-nw.

The wall-A-w is a go-wall in Room-A. The flopside of wall-A-w is the wall-F-e. The dirname of wall-A-w is dir-west.
The wall-F-e is a go-wall in Room-F. The flopside of wall-F-e is the wall-A-w. The dirname of wall-F-e is dir-east.

[The wall-D-nw is a go-wall in Room-D. The flopside of wall-D-nw is the wall-F-se. The dirname of wall-D-nw is dir-nw.
The wall-F-se is a go-wall in Room-F. The flopside of wall-F-se is the wall-D-nw. The dirname of wall-F-se is dir-se.]

The wall-F-nw is a go-wall in Room-F. The flopside of wall-F-nw is the wall-G-se. The dirname of wall-F-nw is dir-nw.
The wall-G-se is a go-wall in Room-G. The flopside of wall-G-se is the wall-F-nw. The dirname of wall-G-se is dir-se.

The wall-B-n is a go-wall in Room-B. The flopside of wall-B-n is the wall-H-s. The dirname of wall-B-n is dir-north.
The wall-H-s is a go-wall in Room-H. The flopside of wall-H-s is the wall-B-n. The dirname of wall-H-s is dir-south.

The player is in Room-A.



Chapter - The Doors Catalog

An oak-door is a kind of go-door. The printed name of an oak-door is usually "[dirname] oak door".
The material of an oak-door is usually "oak".
The article-material of an oak-door is usually "an oak".
The gloss of an oak-door is usually "It is a fine dark oak, polished to a gloss".
Understand "dark", "oak", "oaken" as the oak-door.

The door-e-oak is an oak-door. The dirname of the door-e-oak is dir-east.
The door-w-oak is an oak-door. The dirname of the door-w-oak is dir-west.
The flipside of door-e-oak is door-w-oak. The flipside of door-w-oak is door-e-oak.

Check examining an oak-door when the noun is carried:
let D be the dirname of the noun;
instead say "You are holding [article D] door, made of dark polished oak. It's not attached to a frame or anything. It's just a slab of wood in your hands[first time]. Awkward, to be sure[only]."

A pine-door is a kind of go-door. The printed name of a pine-door is usually "[dirname] pine door".
The material of an pine-door is usually "pine".
The article-material of an pine-door is usually "a pine".
The gloss of an pine-door is usually "It's made of rough-cut but close-fit pine".
Understand "pine" as the pine-door.

The door-s-pine is a pine-door. The dirname of the door-s-pine is dir-south.
The door-n-pine is a pine-door. The dirname of the door-n-pine is dir-north.
The flipside of door-s-pine is door-n-pine. The flipside of door-n-pine is door-s-pine.

The door-s-pine is in Room-B. The linked-wall of door-s-pine is wall-B-s. The linked-door of wall-B-s is door-s-pine.
The door-n-pine is in Room-C. The linked-wall of door-n-pine is wall-C-n. The linked-door of wall-C-n is door-n-pine.

An ash-door is a kind of go-door. The printed name of an ash-door is usually "[dirname] ash door".
The material of an ash-door is usually "ash".
The article-material of an ash-door is usually "an ash".
The gloss of an ash-door is usually "It is pale ash wood".
Understand "pale", "ash" as the ash-door.

The door-e-ash is an ash-door. The dirname of the door-e-ash is dir-east.
The door-w-ash is an ash-door. The dirname of the door-w-ash is dir-west.
The flipside of door-e-ash is door-w-ash. The flipside of door-w-ash is door-e-ash.

The door-e-ash is in Room-D. [unlinked]

An ebony-door is a kind of go-door. The printed name of an ebony-door is usually "[dirname] ebony door".
The material of an ebony-door is usually "ebony".
The article-material of an ebony-door is usually "an ebony".
The gloss of an ebony-door is usually "It is ebony so fine you cannot see its grain".
Understand "ebony" as the ebony-door.

The door-se-ebony is a ebony-door. The dirname of the door-se-ebony is dir-se.
The door-nw-ebony is a ebony-door. The dirname of the door-nw-ebony is dir-nw.
The flipside of door-se-ebony is door-nw-ebony. The flipside of door-nw-ebony is door-se-ebony.

The door-se-ebony is in Room-G. The linked-wall of door-se-ebony is wall-G-se. The linked-door of wall-G-se is door-se-ebony.
The door-nw-ebony is in Room-F. The linked-wall of door-nw-ebony is wall-F-nw. The linked-door of wall-F-nw is door-nw-ebony.
The door-se-ebony is locked. The door-nw-ebony is locked.

Check unlocking an ebony-door with:
if the second noun is not a key:
instead say "That isn't a key.";
if the second noun is not the old-key:
instead say "[The second noun] doesn't fit this lock[first time]. You take a moment to curse whichever interplanar joker got you into this[only].";
if the noun is unlinked:
instead say "[The second noun] fits the lock, but it doesn't turn.";
if the noun is unlocked:
instead say "[The noun] is already unlocked.";
now the noun is unlocked;
now the flipside of the noun is unlocked;
instead say "You fit [the second noun] into the lock. [The noun] unlocks with a satisfying click.";

Check locking an ebony-door with:
if the second noun is not a key:
instead say "That isn't a key.";
if the second noun is not the old-key:
instead say "[The second noun] doesn't fit this lock.";
if the noun is unlinked:
instead say "[The second noun] fits the lock, but it doesn't turn.";
if the noun is locked:
instead say "[The noun] is already locked.";
if the noun is open:
say "(first closing [the noun])[command clarification break]";
now the noun is closed;
now the flipside of the noun is closed;
now the noun is locked;
now the flipside of the noun is locked;
instead say "You fit [the second noun] into the lock and relock [the noun].";

Chapter - Debugging - not for release

[The player carries a wand.] [I used a wand object in early testing, but deleted it in later testing.]

[Print out the map.]
Understand "map-index" as a mistake ("Map-index is [map-index], length [number of entries in map-index].")

[I had some trouble with code that referred to "wall-A-e" rather than "the wall-A-e", which led to accidentally proper-named walls. This rule checks for that mistake.]
When play begins:
repeat with W running through go-walls:
if W is not not-a-wall and W is proper-named:
say "(BUG) [The W] in [holder of W] is proper-named."




Last updated February 29, 2020.

Zarfhome (map) (down)