PLAYER ORIENTED COMMANDS (OW)
RECEIVER

Used for commands that apply to specific players such as resources, teams, number of heroes controlled and time a hero can live without a town.

!!OW:XXXX;

These are commands that apply to a specific player.

OPTIONS

A#/$; Get/Check/(Set) active hero
   # - Owner (0...7,-1=current)
   $ - Hero number (0...155,-1=not chosen) (See Format H)
C?$; Get/Check current player
   $ - Get or check current player (will return 0..7 - see Format E1).
Comments:
You can only get or check, but not set the value.
e.g., !!OW:C?i;
D#1/#2; Set the number of days that a player remains in the game after losing his or her last town.
1.#1 = gamer number (see Format E1) or current (-1)
   #2 = days to be gone (0...127) or live forever (128..254).
If you set 128..254, the gamer will not get a message with a countdown until he captures at least one town and then loses his last one. 255 sets the standard default of 7 days.

2.#1 = -2 - sets the default to to be gone (standard default is 7)
   #2 = days (ex: 0...127), (128..255) all players will stay alive forever.
If you set 128..254, the gamer will get an initial message saying he must capture a town within a week but no more following that.
If you set 255, the gamer will get this message every day.
If you capture a town and then lose your last town, the default set by using -2 will remain in effect.

G$1/$2;

Check if a player IS a player that is sitting before the PC screen
Multiplayer command
   $1 - Player (color).
(see Format E1
   $2 - Check the Player
         1=yes, it is me, 
         0=no, this is another human player
Comments:
This is important for multiplayer only. The point is that there are more than one human player and we have to know whether a player is a human here (1) or there (0). Of course, the main syntax is check or get the value, but you can also set it (though we did not try it :-)
For AI this is always 0.

Flag 999 set to 1 if current player (when trigger worked out) is a player "here" and 0 if he is at other PC.
AI also has it always at 0. If flag 999 set, you can be sure that this is human and he is here. Flag 999 is working for all triggers

H#1/$2/#3; Calculate and get numbers of heroes.
   $1 - Owner (-1=current). See Format E1.
   $2 - Start index of v variables to store info.
      v[$2] = number of heroes.
      v[$2+1] = number of first hero.
      v[$2+2] = number of second hero.
   #3 is an index of a hero the owner has.
      = 0 - store number of all heroes the owner has in v[#2]
      > 0 - index, store the number of a hero the owner has to v[#2] if there is no hero with index, the v[#2] is not changed.There is NO check or get syntax!

Example:
!!OW:H1/99/0; store a number of heroes the Blue player has to v99
!!OW:H1/100/1; store the number of the first hero the Blue player has to v100
!!OW:H1/100/2; store the number of the first hero the Blue player has to v100
!!OW:H1/100/3; store the number of the first hero the Blue player has to v100
!!OW:H1/100/4; store the number of the first hero the Blue player has to v100

 
I#1/$2; Set/check/get AI
 #1 - Color (see Format E1)
 $2 - Controller
  
     1 : AI 
   
    0 : Human
I#/$1/$2; Additional syntax
   # - Owner (see Format E1)
   $1 - AI/human
   $2 - Player killed (1) or alive (0)
K#1/#2/$; Set/check/get the state of a keymaster tent 
   
#1 - Owner (-1=current,0...7) (See Format E1)
   
#2 - Keymaster number (0...7) (See Format BG)
   
$ - Visited(1) or not(0) 
Example:
!!OW:K3/4/1; 
!!OW:K3/4/?v123; 
N#/$; Check/get/(set) active town 
  
# - Owner (0...7,-1=current) (see Format E1)
  
$ - Town number (0...47,-1=not chosen)
N#1/#2/$;

N#1/#2/$/0;
Check/get/(set) active town
You can get a number of a town that is shown in one of 5 slots at the right side of the adventure map in the town list:
#1 - is an owner (-1=current)
#2 - is an index of the slot (0=top..4)
$ - is a town number (-1=no town,0..N=number of towns)
Comments:
You can use only GET or check syntax.
Example:
!!OW:N2/3/?y10; get the number of a town that is located in the forth slot for the Blue player and store it in y10.
Note: You can use forth dummy (which can be any number) parameter to use extended syntax
O#1/#2/$;
Set/check active hero number in hero list
You can get the number of a hero that is shown in one of 5 slots
at the right side of the adventure map in the hero list:
#1 - is an owner (-1=current)
#2 - is an index of the slot (0=top..4)
$ - is a hero number (-1=no hero,0..N=number of heroes)
Comments:
You can use only GET or check syntax.
Example:
!!OW:O2/3/?y10; get the number of a Hero that is located in the forth slot for the Blue player and store it in y10.
O#/$1/$2/$3/ $4/$5/$6/$7/ $8/$9/$10; Set/check active hero number in hero list
#=number of owner (-1=current) (see Format E1)
$1 - number of heroes the owner has
$2..$10 - Hero ID numbers owned by this player (-1=no hero) (See Format H)

Comments:
This command lets you check the hero numbers of all active heroes (maximum is 8) that a player has as they appear in the hero list (left side of the main adventure map screen). They can also be set if you wish to change the order that heroes appear in this list. If the owner has less than 8 heroes, the numbers at the end will have a value of -1.
R#1/#2/$3; Set/check/get a resource
   #1 - Owner (See Format E1)
   #2 - Resource type (See Format R)
   $3 - Resource value
You can use a set style Ri/3/1000 or R3/j/d500... or get style Rj/5/?n. 
In the latter case, the current value of the resource is not changed.
Owner may be -1 which means the current player R-1/.../...
S#1/#2;
Cast spells on the adventure map
#1 - is a case (for now 1 or 2)
In case 1:
#2 - is a spell number to cast (0..9)
The spell will be cast by the current hero.
In case 2:
#2 - is a dummy number (say, 0)
This will open the magic book for the current hero. This is actually a
way to simulate a player clicking the "cast spell" button.

Comments:
1. No spell book is needed and the hero doesn't need to know the spell.
2. The skill level is based on the hero's elemental magic skill (as usual).
3. Spell points are removed from the hero when the spell is cast, but if
the hero doesn't have enough it will be cast anyway (and it will never
be reduced below 0).
4. The hero must still have enough remaining movement points for Dimension Door
or Town Portal to work.
T#1/$2; Set/check/get Alliance Team
   $1 - Color (See Format E1).
   $2 - Team (0..6)
Set/check/get $2 Team for $1 Color (changes alliances). 
Please note that if owner is neutral (value for object owner is -1), there is no need to get alliance team.
 If however you do so, the resulted team number is shown as 0 (which in most cases is the same alliance number for human red player).
 To check if owner of i.e. a castle is neutral use see CA section
V#/$1/$2; Set/get/check Heroes available to hire in tavern
   # - Owner (See Format E1).
   $1 - Left hero to hire in a tavern (-1 = none, see FormatH)
   $2 - Right hero to hire in a tavern (-1 = none, see FormatH)
Comments:
We cannot guarantee that all will work fine if you set one hero for several players (and as a second copy for one player).
The Hero that is set to be hired in a tavern will be temporary set as disabled.
W#/$1/$2; Check/get/(set) number of towns owner controls (shown in town list)
  
# - Owner (0...7,-1=current) (see Format E1)
  
$ - Number of Towns (0...47)
W#1/#2/$; Check/get/(set) number of number of owner's town in the list
  
#1 - Owner (0...7,-1=current) (see Format E1)
  
#2 - Town's number in the player's list (0...47)
  
$ - Town's number on the map  (0...47)

If you want to give or take money from a player rather than setting it to a completely new number, use a relative syntax:
!!OW../6/d100; to give 100
!!OW../6/d-100; to take 100 (do not get below 0 :-)