Elements of DSA Syntax

The variable parts of the instructions contain information such as dungeon locations, message delays, integers, etc.  In the definitions of the instructions these variable parts are shown between broken brackets like so (with a couple of examples):

    L<value>
    L0
    L4096

Often there are default values for these variable parts.  If you are allowed to omit something then it is shown in square brackets like this:

    [<next state>]L<value>
    4L7
    0L4096
    L22

Which menas that you need not specify the next state.  If you don't specify it, the default will be used and that default is explained in the definition of the instruction or in the description of the syntax for <next state>.

In this section we are going to explain all the variable parts that might be used in an instruction.  Sometimes an element of the syntax is defined using previously defined elements.  The vertical bar ( '|' ) is pronounced 'Or' and means either the thing before the bar or the thing after.  For example, "A|B|C" means either 'A' or 'B' or 'C'.  Ready?  Here goes.

<integer>
A positive decimal number
0
4096
<signed integer>
[+|-]<integer>
A decimal integer optionally preceeded by '+' or '-'
+0
-4096
<level>
<integer>
Default is current level.
An integer specifying a level in the dungeon design.
12
0
<position>
N | E | S | W
Default is N.
A position within a dungeon cell.  In a wall it means North, East, South, or West.  In an open cell it is NW, NE, SE, or SW.  When converted to numbers, N is 0, E is 1, S is 2, and W is 3.
<column>
S0 | C0 | T0 | S1 | C1 | T1 | S2 | C2 | T2 | S3 | C3 | T3
Default is S0.
This refers to 'columns' in the DSA itself, not to the dungeon.  The DSA is thought of as rows and columns.  The rows represent the states and the columns represent the various messages that can be received.  Some instructions allow you to change the sequence of execution to another state/column and these are the names of the columns.
<position Mask>
<integer>
This integer is a bit mask.  The bits and their respecive values are:

0 1 North
1 2 East
2 4 South
3 8 West

You add values to specify more than one allowed position.  For example, to specify positions East and South you would write the sum of the values of East and South.  2 plus 4.  In other words 6.  To specify North or West you would write the sum of 1 and 8.  That is 9.
<objectTypeMask>
<integer>
This integer is a bitmask.  The bits and their respective values are:

 0     1 Door
 1     2 Teleporter
 2     4 Text
 3     8 Actuator
 4    16 Monster
 5    32 Weapon
 6    64 Clothing
 7   128 Scroll
 8   256 Potion
 9   512 Chest
10  1024 Miscellaneous
14 16384 Missile
15 32768 Cloud

To specify more than one type you add their values together.  For example, to specify Weapons or Potions you would write the sum of 32 and 256.  In other words 288.
<absoluteLocation>
<level>(column,row)[<position>]
Default <position> is N (0 or North).
This specifies an absolute location within the dungeon.  'absolute' means the location after any level offsets have been applied.  This is the location shown by CSBuild.  'column' is the east-west column number and 'row' is the north-south row number.
<nextState>
<integer>
Default is the current state.
This is the state the DSA will enter when all processing is completed.  It will enter this new state and await another message.
Note: Be careful....the <nextState> from the first instruction executed when a DSA is activated determines the next state.  Even if it is not explicitly specified. The <nextState> from subsequent instructions is ignored.  To override this behaviour, you can use the &SETNEWSTATE instruction.
<delay>
<integer> | A | B
Default is 0.
This specified a delay in units of the basic game clock, about one-sixth of a second.  The delay can be specifed by an integer or one of the DSA parameters can be used as the delay.  Notice that the delay can be very long!  The maximum is 65535 or about 10000 seconds.  That's about 3 hours.
<messageType>
S | C | T | N
Default is S.
Type of message to be sent.  S = Set.  C = Clear.  T = Toggle.
The message type 'N' means 'No message'.  This can be used to provide a 'do-nothing' instruction.  (All proper languages have a 'do-nothing'.  And besides, I had to do something with the one extra value provided by those two bits.)
<target>
<absoluteLocation> | * | A | B
Default is A.
The asterisk ( * ) means that the target is specified by the integer on top of the stack  That integer specifies a level, x, y, and position.  The bit assignements:
2 Bits 17-16 position
6 Bits 15-10 level
5 Bits  9- 5 x (column)
5 Bits  4- 0 y (row)

To use parameter C, for example, you could do this:

LC M*

<value>
<integer> | <absoluteLocation> | A | B | C | D | .........

<from>
<target>
<to>
<target>

Return to Index