&ADD

&ADD ( posMsk  location  objectID  . . .  )

Use the &ADD operation to duplicate an object and place it in the dungeon.  You can place the object in one of the cells of the dungeon itself, on a character (in the backpack, as an item of clothing, or in a hand, etc.), on the cursor, or as a monster's possession.  The location parameter determines where the object will be placed:

-----In the cursor------
If the cursor already contains an object then no object is created or placed.
The 'posMsk' parameter is ignored. 

-----On a character-----
The 'location' parameter is of the form:  - ( 100 * characterOrdinal + packIndex ).
If an object is already present at that spot in the backpack then no object is created or placed.
The 'posMsk' parameter is ignored.
See Pack Indices for the numeric location numbers.

-----On a Monster-----
The 'location' parameter is of the form:  - ( 1000 * monsterID ).
The ''posMsk' parameter is ignored.

-----In a cell of the dungeon------
The 'location' parameter determines the cell in which the object is placed.  The 'posMsk' parameter determines the position within the cell.  'posMsk' is a bit-encoded value with bit zero standing for direction zero (north), etc.  If 'posMsk' is non-zero then the object is placed randomly in one of the positions for which the corresponding bit is non-zero.  If, for example, 'posMsk' is set to 5 then the object will be placed randomly in either position zero (north) or position two (south).  If 'posMsk' is zero (no bits set) then the object is placed at position zero.  The 'location' parameter is encoded as three bitfields.  Bits 10-15 are the 6-bit level number, bits 5-9 are the x (or column) coordinate, and bits 0-4 are the y (or row) coordinate.