EXPERIENCE (EX)
RECEIVER

Receiver for creature stack experience.

!!EX$1/$2:XXXX; $1 - hero index (-1, 0...MaxHeroInd, see format H)
$2 - slot index (0...6)
!!EX$1/$2/$3/$4:XXXX;  $1 - x coordinate (0...)
 $2 - y coordinate (0...)
 $3 - level of the map (0,1)
 $4 - slot index (0...6)
Here you may give the location of a Hero, Town, Mine, or Garrison at position x/y/l.
!!EX$1/$2/$3/$4/$5:XXXX;   $1 - x position
  $2 - y position
  $3 - map level
  $4 - slot index (0...6)
  $5 - type of owner
     1 = Hero
     2 = Town
     3 = Mine
     4 = Garrison
     other = any first found
   Comments
   If you use 4 parameters, the fifth one will default to "any first found". The searching goes in the order: heroes, towns, mines, garrisons.

OPTIONS

A$1/$2/$3; Set/check/get stack info.
$1 - monster type
$2 - number of creatures
$3 - experience per creature
C$1/$2/$3(/$4/$5/$6); EX Receiver command for stack combining
  $1 = type of source stack
  $1 = 0 - hero by type
        $2 - hero index (-1 = current)
        $3 - hero's slot (0...6)
        $4 - warning type (see below)

  $1 = 1 - hero by position
  $1 = 2 - town by position
  $1 = 3 - mine by position
  $1 = 4 - garrison by position
        $2 - x position
        $3 - y position
        $4 - map level
        $5 - army slot (0...6)
        $6- warning type()

Returns.
The function set v1 variable.
  = -1 - stack of different creatures (nothing combined)
  =  0 - error occurred (nothing combined)
  =  1 - combined successfully

Comments.
This function will add the source stack to the main stack assuming they are of the same creature type. All experience is distributed. Artifacts are summed.
If you set warning type to 1 (default is 0), you will not get a message that creature types of two stacks are different. You may use it.
Example:
A hero visits an object and his stack 3 is added to stack 1 (they should be of the same type):
!?OB5/3/0;
!!EX-1/1:C0/-1/3;

Another example.
You visit an object and you current hero "adds" a stack number 1 in a town with an entrance at 3/2/0 to the stack number 3.
!?OB5/3/0;
!!EX-1/3:C2/3/2/0/1;
T$; Set/check/get stack monster type.
$ - monster type
N$; Set/check/get stack number of creatures.
$ - number of creatures.
E$; Set/check/get stack experience.
$ - experience.

ARTIFACT SUPPORT FOR STACK ARTIFACTS.


R$1 /$2; Set/check/get artifact and option
  $1 = artifact index
  $2 = artifact option
Comments:
  For now only one artifact index is supported - 156 (Warlord's banner).
  For now only options 0...8 are supported
R$1/$2/$3/$4; Extended syntax for stack artifacts
   $1
- has art or not (0=no, 1=yes)
   $2 - type of art (for now only 156).
   $3 - subtype of art (options 0...15 - we use not all yet)
   $4 - number of art copies (0...3)
  Comments
  You can use get or set syntax.