&NEIGHBORS
&NEIGHBORS ( location criteriaMask . . . result )
This word looks at the four neighbors of a cell and sets a bit in the result for each of the
neighbors that meets the criteria described by the criteriaMask. This word might be
useful to determine an escape route for the party, for example.
Bits in the result are:
bit 0 - North
bit 1 - East
bit 2 - South
bit 3 - West
The criteriaMask is divided into three sections:
1 - type of cell - bits a through b
2 - contents of cell - bits c through d
In order for a bit to be set in the result, the cell must match at least one bit in the 'type of cell' section
and at least one bit in the 'contents of cell' section.
The 'Type of Cell Bits' are
bit 0 - Cell outside the dungeon (seen as a stone wall)
bit 1 - Solid stone wall
bit 2 - Real pit - open
bit 3 - Real pit - closed
bit 4 - False pit - cannot fall through
bit 5 - Door - open
bit 6 - Door - mostly open
bit 7 - Door - half open
bit 8 - Door - mostly closed
bit 9 - Door - closed
bit 10 - Door - smashed
bit 11 - Teleporter (objects only) active
bit 12 - Teleporter (objects only) inactive
bit 13 - Teleporter (party/objects) active
bit 14 - Teleporter (party/objects) inactive
bit 15 - Teleporter (monsters only) active
bit 16 - Teleporter (monsters only) inactive
bit 17 - Teleporter (anything) active
bit 18 - Teleporter (anything) inactive
bit 19 - Open
bit 20 - Trick Wall visible but passable
bit 21 - Trick Wall visible and impassible
bit 22 - Trick wall invisible and passable
bit 23 - Stairs up
bit 24 - Stairs down
The 'Contents of Cell' bits are:
bit 31 - Empty of monster or party
bit 30 - Occupied by monster
bit 29 - Occupied by party
Example. Suppose you want to know in which direction the party
could proceed without falling through a pit or being teleported
or moving to a different level. The criteriaMask should have the
following bits set:
bits 3 and 4 - a safe pit.
bits 5 - an open door
bits 11, 12, 14, 15, 16, and 18 - inactive/nonparty teleporters
bit 19 - an open cell
bits 20 and 22 - a passable trick wall
bit 31 - No monster is there