HERO (HE)
RECEIVER

Used to modify characteristics, troops, inventory, skills, location and just about everything imaginable for a specified hero. Also used for setting blessings and curses.

When any hero steps !?HM trigger occurs.

Note:
v998/v999/v1000 variables will store the location of the current hero visited.
Also, you can refer to it easily with an indirect reference (for example: !!HE998:...; )

For a more detailed and explained version of HE receiver, read the HE receiver easily explained (ERM for dummies, by Qurqirish Dragon)

!!HE#:XXXX; The hero number of # (see Format H - each hero has a unique number in the game).
!!HE#1/#2/#3:XXXX; The hero at x,y,l coordinates
  #1 = x
  #2 = y
  #3 = level (0-Surface, 1-Underground)
!!HE-1:XXXX; Current hero, the hero who activated the trigger. Using this format simplifies things greatly as you do not need to keep changing the coordinates for every !!HE command if you move the trigger event or object.
Note:
When you load a saved game, the top Hero in the Hero scroll list appears to be active, but the MGO trigger (Spell Book) will not have a valid Hero number for HE-1 at this point! Use OW:A to check whether there is an active Hero, to avoid error messages.
!!HE-10:XXXX; Attacking hero in battle.
!!HE-20:XXXX; Defending hero in battle.

OPTIONS

A1/$1/$2
A2/$1/?$2/?$3
A3/$1/$2/$3
A4/$
A#
These commands let you equip, check, calculate, or delete one or more artifacts from a hero.
  (When you equip/take off an artifact, !?AE trigger occurs.)

All artifacts start from 7 (Centaur's Axe) on.
1000 is a magic book
1001 on means a scroll with a spell of format SP and number is calculated as [artifact number]-1001.

A1/$1/$2 - Equip an artifact
  $1 - number of artifact. (see Format A1).
  $2 - position on the body where to place (see Format AP).
Notes:
 - If the slot is busy, the ERM Flag1 will be set to 0 otherwise to 1.
 - If you use HE:A1 to equip an artifact that gives spells, such as a Tome, Spell Scroll or Spellbinder's Hat, the spell won't be added. It will only be added if the player unequips and reequips the artifact.
 - If you use the HE:A1 command to equip an artifact, it will equip into a locked slot and the slot won't register as busy.

A2/$1/$2/$3 - Calculate numbers of an artifact (get or check)
    $1 - Number of artifact. (see Format A1).
  ?$2 - Returns number of artifacts of the type hero has
  ?$3 - Returns the numbers of equipped artifacts of the type

A3/$1/$2/$3 - Remove several copies of artifact
  $1 - Number of artifact. (see Format A1).
  $2 - Numbers of copy to delete
  $3 - Flag to delete first equipped (1) or in backpack (0)
Notes:
 - If you remove an artifact that has added a spell to a hero's book with ERM (HE:A- or HE:A3), the spell remains in the hero's book permanently.
 - If you remove an artifact with HE:A- it will correctly remove the added bonuses but if you remove it with HE:A3 it won't remove the bonuses.
 - If you remove a combo artifact with HE:A- it will correctly remove the locked slots and added bonuses too, but if you remove it with HE:A3 it won't remove either!

A4/$ - Equip an artifact
You can now automaticaly add spells from artifacts. Also, the locked slots problem solved.
  $ - Number of artifact. (see Format A1).
Notes:
1.  Uses an internal function for this so artifact will be equipped if possible and not equipped (put to backpack) otherwise.
2.  HEm:A4/n will cause the !?AE1 (equip) trigger to execute for artifact n. (But HEm:A-n will NOT cause !?AE0 (unequip) to execute!
Example:
A# - Give/remove an artifact.
  # is the artifact's number (see Format A1).
    If # > 0 the artifact will be added to the hero's backpack
    If # < 0 removes the artifact from all slots.
Example:
!!HE106:A-1; [Remove all scrolls in Lydorie's possession]

Safe functions equip or delete an artifact (author: Berserker):
<script type="erm">

!?FU338354; equip art
; x1 - hero or - 1 for current
; x2 - art type
; x3 - art subtype or -1 (usually for non-scrolls)
; x4 - slot or -1
!!UN:C6919480/4/?y1;                    [y1 - BASE]
!!VRy2:Sx1*1170+y1+136736;              [y2 - pointer to hero structure]
!!VRy5:S3*4+10784128-4;                 [y5 - pointer to y3]
!!VRy3:Sx2;                             [artifact type = 5]
!!VRy4:Sx3;                             [set y4 to subtype]
!!SN:E5123184/2/y2/y5/x4;

!?FU338357; unequip art
; x1 - hero or - 1 for current
; x2 - slot
!!HE-1&x1=-1:N?x1;
!!UN:C6919480/4/?y1; [y1 - BASE]
!!VRy2:Sx1*1170+y1+136736; [y2 - pointer to hero structure]
!!SN:E5123648/2/y2/x2;

!?FU338355; check if artifact can be put in slot possible replacing existing art
; x1 - hero or - 1 for current
; x2 - art
; x3 - slot
; return v1 = 1 (yes) or 0 (no)
!!UN:C6919480/4/?y1; [y1 - BASE]
!!VRy2:Sx1*1170+y1+136736; [y2 - pointer to hero structure]
!!SN:E5122736/2/y2/x2/x3;
!!VRv1:&1;

*******************************************************************************************

!?FU338354; extract hero arts
; x1 - hero
; v1 - SN:M array of art/id pairs
!!VRy1:S0;        [y1 - slot]
!!VRy10:S0;       [y10 - array index]
!!SN:M-1/28/0/0;  [allocate array 14 * 2 of temp integer]
!!VRy2:Sv1;       [y2 - reslut]
!!HEx1:A1/?y3/y1; [#4 y3 - art type]
!!VRy4:S-1;       [y4 - art subtype]
!!if&y3>=1001:;   [correct type/subtype for scrolls]
  !!VRy4:Sy3-1001;
  !!VRy3:S1;
!!en:;
!!FU338357&y3<>-1:Px1/y1; [unequip art if any]
!!SN:My2/y10/y3;  [save art info]
!!VRy10:+1;
!!SN:My2/y10/y4;
!!VRy10:+1;
!!VRy1:+1;
!!VRy1&y1=13:S18;
!!SN&y1<=18:G4;
!!VRv1:Sy2;

!?FU338353; equip hero arts from SN:M array
; x1 - hero
; x2 - SN:M array
!!VRy1:S0;       [y1 - slot]
!!VRy2:S0;       [y2 - array index]
!!SN:Mx2/y2/?y3; [#2 y3, y4 - art type/subtype]
!!VRy2:+1;
!!SN:Mx2/y2/?y4;
!!VRy2:+1;
!!FU338354:Px1/y3/y4/y1; [equip art]
!!VRy1:+1;
!!VRy1&y1=13:S18;
!!SN&y1<=18:G2;
</script>
<script>
B0/z$ Set/get the name of a hero.
  $ - number of z-variable with new name.
 Now if you customize a name but do not set a biography, it will display a hero's default biography, rather than setting it to the same string as the customized name. So if you want to name Orrin Orrin II, it will still display Orrin's default biography.
B1/$ Set/get the bios of a hero.
Comments:
If it has a default name or bio, you will get a void string not default text.
Example:
B2/$ Set/get the class of a hero.
   $ is a class (0...17, see Format HC)
Divide $ to 2 and you will get a town type of a class.
B3/?$ Read a hero's default biography.
Get a hero's default biography text to a string variable.
This will always return the same text whether you changed the hero's biography text or not. You may use only get syntax, like this:
C0/#1/$2/$3 Set/get monsters by hero slot
  #1 - hero's slot number (slots are numbered 0..6)
  $2 - monster type (Format C)
  $3 - number of monsters

  This command may be used to determine which creatures a hero has in his or her army slots, and also the number of those monsters in each slot. It can also be used to change the type or number of creatures in that slot. Use the 'd' modifier (as usual) for a relative change. e.g., !!HE-1:C0/0/d/d5; This would add 5 creatures of the same type to the current hero's first army slot (slot 0).
Note:
 a value of -1 for type means none.
C1/#1/$2/$3 Change monsters by type
All monsters of type #1 will change into:
  $2 - type: Format C
  $3 - number.

Example:
Note:
If you use a value of -1 for $2 or 0 for $3, all creatures of that type will be removed from the hero.

You can also get the number ($3). Getting the number ($3) lets you quickly check if a hero has any creatures of a given type without using a loop. However, if a hero has multiple stacks, it will only return the number of creatures of that type in the last creature slot that contains those creatures. For example, suppose a hero has:
   Slot 0: 14 Cyclops
   Slot 1: 18 Cyclops Kings
   Slot 2: 50 Pikemen
   Slot 3: 100 Halberdiers
   Slot 4: 9 Cyclops
   Slot 5: 49 Pikemen
   Slot 6: empty
C2/#1/#2/#3 Add a new stack of monsters to a hero.
  #1 = type of monsters (Format C
  #2 = number of monsters
  #3 = 1 - ask human to find room in the army if all slots are filled.
       = 0 - use AI to add it (if it feels the addition is more valuable than an existing stack)
C#1/#2/..../#14 Change monsters : Give to player a choice of monsters set.
   #1 = type of monster 1 (-1 = no, see Format C)
   #2 = number of monsters 1
   #3 = type of monster 2 (-1 = no, see Format C)
   #4 = number of monsters 2
   #5 = type of monster 3 (-1 = no, see Format C)
   #6 = number of monsters 3
   #7 = type of monster 4 (-1 = no, see Format C)
   #8 = number of monsters 4
   #9 = type of monster 5 (-1 = no, see Format C)
   #10 = number of monsters 5
   #11 = type of monster 6 (-1 = no, see Format C)
   #12 = number of monsters 6
   #13 = type of monster 7 (-1 = no, see Format C)
   #14 = number of monsters 7
Example:
This will be a dialog like when you leave creatures.
C(...)
(SE support)
Extended !!HE:C0, !!HE:C1 and !!HE:C2 syntax for setting or retaining Stack Experience.
(Note:  does not work with C#1/#2/..../#14).

Now these commands may have 5 or 6 parameters: !!HE...:C#/#1/$2/$3/$4/$5;
  # = 0 - change monsters (by slot)
  # = 1 - change monsters (by type)
  # = 2 - add stack of monsters
  $4 = experience value (default is 0)
  $5 = experience modifier (default is 0)

Supported $5 modifier values:

Mode 0 - Use this mode to add additional creatures that have experience.
  New creatures have their own experience $4, but old creatures (if you add monsters) keep their own experience. The result of experience per creature is calculated as:
Exp=(ExpOld*NumOld+ExpNew*NumNew)/(NumOld+NumNew)
a) Say you have a stack of 10 Monks with Exp 1000 (here and later per creature) and want to add 5 Monks with experience 3000.
The result will be: (1000*10+3000*5)/15=1666
E.g. HE...:C0/0/d/d100/5000/0;
Add to the stack 100 creatures with exp 5000.
b) If you add a creature of a different type, only the experience of the new creatures is taken. So if you have 10 Griffins Exp 1000 and want to add 5 Monks with experience 3000.
The result will be: 3000.
This is used to avoid problems when you move stacks from one slot to another and the experience is mixed. Say you placed a stack of Griffins in the stack 1 and then changed it to Monks accidentally forgot to change experience (so it IS a stack of Monks but the system thinks that it IS a stack of Griffins). So now adding more Monks, the system will think that you changed the type of creatures and takes only experience of new creatures.
Exception: if the stack has not gained experience yet the experience will be averaged as if you weren't changing the type (same as mode 1).
Note:
do not use the 'd' modifier for $4 with mode 0.

Mode 1 - The same as Mode 0 except that there is no check of creature type. So it always works according a) formula (above) whatever type of ex and new creature type you have.
  Examples.
a) you want to set creatures in slot to Pikemen and they should have the experience (per creature) of previous creatures in the stack (whatever they were) plus new 7 creatures has 50 exp. points.
!!HE...:C0/1/0/d7/50/1;
Note:
do not use the 'd' modifier for $4 with mode 1.

Mode 2 - Use this mode to set experience for the whole stack.
  The stack will always be set to $4 experience.
Example:
HE...:C0/0/d/d/5000/2;
The stack will have experience 5000
Note:
if you use the 'd' modifier with Mode 2 for $4, it will add the experience instead. This is identical to the operation of mode 3.

Mode 3 - Use this mode to add additional experience to a stack.
  E.g. HE...:C0/0/d/d/5000/3;
The stack will have +5000 experience.
New creatures take the experience of the old creatures plus $4. Experience is not distributed. So if you have a stack of 10 Monks with Exp 1000, want to add 5 Monks and add 3000 experience with Mode 3, the result is: 1000+3000=4000.
E.g. HE...:C0/0/d/d5/3000/3;
The stack will have +5 creatures and +3000 experience.
You can also use this mode to add creatures to a stack without reducing the stack's experience, or change the type of creatures in the stack while keeping the experience unchanged.
You may use this modifier for temporary creature type changing as well, because the new stack will still have the same experience and if you change it then back, the stack will keep the experience.
!!HE...:C0/1/0/d/0/3;
!!HE...:C0/1/99/d/0/3;
!!HE...:C0/1/0/d/0/3;

Note:
if you use the 'd' modifier for $4 with mode 3 it will work the following way:
StackExp=OldExp+OldExp+AdditionalExperience.
So if a stack had 200 experience, and you add 100 experience, it will have 200+200+100=500.
Then if you add another 100 experience it will have 500+500+100=1100.

Mode 4 - Use this mode to add experience Levels (Ranks) to a stack.
  New creatures take the experience of the old creatures plus experience equal to $4 levels.
Experience is not distributed. So if you have a stack of 10 Monks with Exp 1000, and want to add 5 Monks and add 3 experience levels, the result is:
1000+3levels=????
It uses the next calculation:
- we have E exp
- get a current stack exp. level L0
- get an exp. value E0 for level L0
- get a reminder dE as E-E0
- we have a level bonus L
- get a resulting level L1 as L0+L
- get an exp. value E1 for level L1
- get a final exp. E as E1+dE
E.g. HE...:C0/0/d/d/5/4;
The stack will have +5 experience levels.
Note:
do not use the 'd' modifier for $4 with mode 4.

Mode 5 - Use this mode if you upgrade creatures.
  The same as Mode 3 but the experience of new creatures is taken as though you made an upgrade of old creatures. The new experience will be the old experience multiplied by the Upgrade Multiplier plus an experience bonus.
E.g. HE...:C0/0/d/d/500/5;
The stack will have experience as if upgraded +500 experience.
Note:
do not use the 'd' modifier for $4 with mode 5.

Mode 10 - Use this mode to add additional creatures with levels (ranks) of experience.
  This is the same as Mode 0 but $4 means additional levels (ranks) of new creature type experience.
E.g. HE...:C0/0/d/d100/5/10;
Add to the stack 100 creatures with exp of Rank 5.
Note:
do not use the 'd' modifier for $4 with mode 10.

Mode 11 - The same as Mode 10 but regardless of creature types.
  This is the same as Mode 1 but you add creatures with experience equal to $4 levels (ranks).
E.g. HE...:C0/0/3/d100/5/11;
Add to the stack 100 creatures with exp of Rank 5, but also changing their type to Marksmen.

Mode 12 - Use this mode to set the experience level (rank) for the whole stack.
  This is he same as 2 but $4 means experience levels (ranks).
E.g. HE...:C0/0/d/d/5/12;
The stack will have 5 levels (ranks) of experience.

Mode 13 - Use this mode to set the equivalent percentage of experience for a new type of creature.
  This is the same as Mode 3 but it is assumed that you change the type of creatures and a new creature experience is taken as the same percentage that the old creatures have.
So if you have a stack of Monks with exp. X and change it to a stack of Angels, the new experience will be:
X*MaxA/MaxM+dE
where MaxA is a max experience of an Angel and MaxM is a max experience of a Monk, dE is the added experience.
E.g. HE...:C0/0/../d/1000/13;
The new stack gets the corresponding experience that the old stack had plus 1000 exp.
NewExp=OldExp*NewCreatureTypeR10Exp/OldCreatureTypeR10Exp+ExtraExp.

Mode 14 - The same as Mode 13 but an addition is experience levels (ranks).
  E.g. HE...:C0/0/../d/3/14;
The new stack gets the corresponding experience that the old stack had plus 3 levels (ranks) of exp.
D Call upgrade dialog for hero's army (no parameters)
E$ Set/check/get experience# to the hero (Format HL)
E$1/$2 Set/check/get hero's experience (additional syntax)
   $1 - Experience points
   $2 - Hero's level (Format HL)
E$1/?$2/1 Additional Syntax
The same as HE:E$1/?$2 but without redrawing
For standard syntax some of them called redrawing always even if you check only.
F$1/$2/$3/$4 Set/check/get primary skills.
   $1 = Attack
   $2 = Defence
   $3 = Power
   $4 = Knowledge
Note:
Changing hero's stats during a makes no sense: for example if your hero enters battle with 10 spell power and you set it to 20, the spells will still be cast as if the hero had 10 points in spell power.
F?$1/?$2/?$3/?$4/1 Return the base value of hero's primary skills without artifact bonuses.
   $1 = Attack
   $2 = Defence
   $3 = Power
   $4 = Knowledge
Comments:
You can use only get or check syntax. You can also set it but it will do nothing.
Example:
!!HE-1:F?v100/?v101/?v102/?v103/1;
G$ Set initial hero's movement points
  $ - initial hero's movement points.
Comment:
If you set both HE:W and HE:G options to the same value (any), you may dig for the Grail.
H$1/$2/$3/$4 Set army type for newly hired heroes.
   $1 = Slot number (0,1,2)
   $2 = Monster type (-1 means no monster, see Format C)
   $3 = Minimum value of monsters number
   $4 = Maximum value of monsters number (may be equal to min number for fixed number)
Comments:
This will be applied to a hero that CANNOT be hired right now. So if Orrin and Jeddite are currently available in a tavern, their army WILL NOT be changed until next week. But if you change the army of Crag Hack and he will be available to be hired after you hire Orrin or Jeddite, he WILL have the army that you set.
Then, when you hire a hero that appears in a Tavern in the beginning of the week, he will have 2 or 3 slots of army (it's not possible to set 2 or 3 exactly). So you can set 1st and 2nd slots to desired monsters and 3rd slot to -1 monster type. This will result in the hero always having 2 slots of monsters. Then if you hire a Hero, he or she will have only one slot of monsters and number 1.

Example:
Set Army of Orrin to Gnoll at the game start
!#HE0:H0/99/3/3H1/-1/2/2H2/-1/0/0;
This may be used later during a game.
!?LE3/7/0; Trigger for cycle
!!DO21000/0/155/1:P; Set Army to all Heroes
!?FU21000;
!!VRv1:Sx16;
!!HEv1:H0/99/3/3H1/-1/2/2H2/-1/0/0;
I$ Set/check/get spell points.
  $ - number of spell points.
Be sure to use d for relative change if you wish to add or subtract rather than set.
Example:
!!HE-1:Id-1; This will reduce the hero's current spell points by 1.
I$/1 Additional Syntax
The same as HE:I$ but without redrawing
For standard syntax some of them called redrawing always even if you check only.
K Instantly kills the hero
Put this to a well - all will fall inside :-)
L#^file.pcx^ Sets a hero's portrait to an external image file.
   # = 1 - Set small picture to file.pcx
   # = 2 - Set large picture to file.pcx
Comments:
file.pcx will be searched for in heroes DATA directory. But you can use subdirectory. Example ^c\name.pcx^ - in "c" subdirectory of the DATA dir. Or ^..\maps\1.1^ - in MAPS dir of Heroes.
Important! The full length of file name (with subdirectory path) cannot be more than 12 characters.
The screen will be redrawn automatically if you change the hero's portrait.
L0/$ Set hero's portrait to portrait number $. (Cf.CMD file).
Note:
This command doesn't work.
L3/$ Restores the original portrait.
L4/$ Sets both the small and large portrait to the game portrait equal to $.
Note:
If you set hero's portrait to custom in map editor, this command will be ignored
L5/$1/$2 Set a hero portraits.
   $1 - String variable for large pic (0-do not change)
   $2 - String variable for small pic (0-do not change)
M#1/$2 Give/remove spell in the spellbook
  #1 - number of a spell (see Format SP)
  $2 = 0 - remove spell
       = 1 - give spell
Notes:
To check if spell is learned/gained or just learned use the two ways described below:
  - You can check for a spell that the hero has learned *or* that he/she knows due to a scroll or spell-giving artifact by using HE:M#/?$. In *either* case, the variable will have a value of 1 if the hero has the spell.
  - You can check for a spell that the hero has learned but NOT one he/she only knows from a scroll or spell-giving artifact by using HE:M=#/1 with flag 1 set to 1 the hero has learned the spell. If the hero has the spell from a scroll or spell-giving artifact, flag 1 will still be set to 0.
N?$ Check or get the hero's number.
Comments:
Don't try to set the hero's number to something else. It won't work or will cause instability.
Example:
!!HE-1:N?v100;
O$ Set/check/get the hero's owner.
  $ - player who controls the hero (see Format E1).
If a hero isn't on the map and thus has no owner, the number returned will be -1.
Comments:
This command should work properly to let you change the owner of a player, unlike in previous versions where the changeover didn't work completely.
If you try to give a hero to an owner that has 8 active heroes already, the command will be just canceled. Check a hero's owner to be sure that he/she was transferred successfully.
O$/1 Extended HE:O command syntax to use a neutral hero in a battle.
Use a dummy second parameter in HE:O command (like HE-1:O5/1; ) to use this way. If you use a two parameters syntax, it will directly change the hero's owner. You can use this to set an unowned hero to defend a neutral monster stack. After the battle is over, the hero will not be owned. [Setting owner to -1 causes error message.]
Note:
if you change an unowned hero in this way to temporarily give it an owner (number 0..7), it can be read with HE:O, but BA:O will still return -1.
P$1/$2/$3/$4 Move hero
  $1 - x
  $2 - y
  $3 - level
  $4 - style
  if $4 = 1 - move hero with sound and redraw (teleport)
  if $4 = 0 - hero jumps to new place immediately
Comments:
In addition to its normal use of moving a hero on the map, this command can also be used to bring a hero from the hero pool (not currently "in play") into the game. After you bring the hero onto the map with this command, you should then set the hero's owner with the HE:O command.
R0/$ Set/check/get hero's morale (until next battle)
R1/$ Set/check/get hero's luck (until next battle)
R2/$ Set/check/get sex of Hero
Male=0, Female=1.
R3/$ Set hero's availability in the hero pool for all players
  $ - enable (1) or disable (0) hero to hire for all
R3/$1/$2 Set hero's availability in the hero pool for each player
   $1 - enable (1) or disable (0) hero to hire
   $2 - players to affect (see Format E1)
Comments:
$2 makes sense (will be set) only if you enable a hero.
If you disable a hero that is owned by any player, the hero will be killed.
R4/$ Set/check/get a hero's Tactic control
  $ = -1 - Enable
  $ =  0 - Disable
R5/$ Maximum morale
  $ = 1 - maximum morale set
  $ = 0 - maximum morale not set
R6/$ Maximum luck
  $ = 1 - maximum luck set
  $ = 0 - maximum luck not set
R7/$ Set modifiers of visiting structures of temporal changing parameters of a hero.
    $ - modifiers dword, bit mask.
Comments:
In most cases, setting or clearing these bits won't change Luck, Morale, movement or spell points - they only set (or clear) the record of whether the hero has already visited a given type of structure in a given period, e.g., this week, for next battle, etc. However, it will set or clear any text associated with these structure if you click on the hero's Luck or Morale in the hero screen (e.g., "Temple Visited +1"), but you'll still have to set the hero's temporary Luck or Morale with the HE:R0 and HE:R1 commands. See Format HB for the meaning of these bits.
S$ Check or set the number of known skills that are displayed
  $ - number of skills to show (0..8).
Comments:
If you want to display only one skill, first swap it's display position to slot number 1 and then limit the display to only 1 skill with this command.
S#1/$2 Set/check/get secondary skill
  #1 - Skill number (see Format SS)
  $2 - Skill level (0=none, 1=basic, 2 =advanced, 3 =expert).
Comments:
You can even set all(!) secondary skills (28 altogether) but only the first eight will show on the hero screen.
S$1/$2/1 Manage secondary skills showing
  $1 - is a number in display sequence (0 = not shown, 1..8 = slot index)
  $2 - is a skill index (0...27)
Comments:
You may use three types of syntax:
!!HE#:S?#1/#2/1; ask what display slot takes #2 skill to #1 var
!!HE#:S#1/?#2/1; ask what skill occupies display slot #1 to #2 var
!!HE#:S#1/#2/1; set display slot #1 to #2 skill
In the last case if another skill takes this slot, it will be set to "no slot". You can use the command twice to swap two skill positions.

When setting skills with this command, you must use the following rules:
- you may move any two displayed skills to exchange their position;
- you must NOT set a skill to display if it's below Basic level (no skill);
- you must set skills to display in order (no empty spaces);

Therefore you cannot use the command to hide a skill that's already displayed. You also can't use it to set a skill to display if the hero doesn't know the skill. Attempting either will usually display a different "phantom" skill (perhaps Basic Wisdom) that will crash if clicked on.
T$1/$2/$3/$4/$5 Provoke a battle but only with one type of monsters.
  $1 = x position of the battle
  $2 = y position of the battle
  $3 = level of the battle
  $4 = type of monsters to fight (Format C)
  $5 = number of monsters to fight
Comments:
x,y and level are used only for choosing the type of the ground and corresponding bonuses.
U$1/$2/$3 Set/check/get hero's patrol position and radius. 
   Patrol position will be set to X($1), Y($2) (the level is fixed). 
   The radius will be set to $3 ("set free" if $3 = -1).
V#1/$2
V#1/#2/$3
Set/check/get if hero visited objects 'of one visit'.

V#1/$2
  #1 - type of object (Format OV)
  $2 - 32-bit variable which is bit mask for 32 OV-objects of #1 type.

V#1/#2/$3
  #1 - type of object (Format OV)
  #2 - object number (0..31)
  $3 - Hero visited (1) or not (0)

Examples:
V0/0/0 - set the Learning stone number 0 to be "not visited" by the hero.
V6/2/0 - set the Library of Enlightenment number 2 to be "not visited" by the hero.
V5/2 - set all Trees of Knowledge except second to be "not visited" (second one is visited).
W$ Change Hero's movement points
  $ - movement points.
This number is not the number of steps that the hero can take in a turn but is a much higher number (usually between 1500 and 2000 depending on fastest troop speed) that the game sets internally. This was probably done so that they wouldn't have to deal with fractions when calculating terrain bonuses and penalties (plus path finding, logistics, Boots of Speed, etc.). On grass terrain with mixed creatures, 1 step equals about 100 movement points.
Note:
In both SoD and WoG, AI heroes get additional movement points at higher difficulty level settings. At Expert they get 125 extra points and at Impossible, they get 75. While it seems like it should be the other way around (a bigger bonus for the AI at Impossible), it appears that it's set to give more at Expert for some unknown reason.
W$/1 Change Hero's movement points. Additional Syntax
The same as HE:W$ but without redrawing.
For standard syntax some of them called redrawing always even if you check only.
X(...) Change hero's specialty.

To make hero master of a secondary skill
  X0/$1/0/0/0/0/0 or X0/$1
    $1=secondary skill number (see Format SS )

To make hero master of creatures
  X1/$1/0/0/0/0/0 or X1/$1
    $1=creature type number (see Format C )

To make hero keeper of resources
  X2/$1/0/0/0/0/0 or X2/$1
    $1=resource type (see Format R )

To make hero master of a spell
  X3/$1/0/0/0/0/0 or X3/$1
    $1=spell number (see Format SP)

To make hero grandmaster of creatures
  X4/$1/$2/$3/$4/0/0 or X4/$1/$2/$3/ $4
    $1=creature type number (see Format C )
    $2=attack bonus
    $3=defence bonus
    $4=damage bonus

To make hero master of speed
  X5/2/0/0/0/0/0 or X5/2

To make hero master of upgrades
  X6/$1/0/0/0/$2/$3 or X6/$1/$2/$3
    $1=creature 1 to upgrade (see Format C )
    $2=creature 2 to upgrade (see Format C )
    $3=creature to upgrade to (see Format C )

To make hero master of dragons
  X7/$1/$2/0/0/0/0 or X7/$1/$2
    $1=attack bonus
    $2=defense bonus

To make hero master of WoG speciality
  X8/$1/0/0/0/0/0 or X8/$1
   $2=subtype
       =1 for Walking Darkness
       =2 for Builder

Comment:
You may use 'd' modifier to ignore unchanged settings: HE:...:X8/2/d/d/d/d/d;
The original syntax (number of parameters < 7) should work as before.

Example.
To check the current settings use:
!!HE#:X?y5/?y6/?y7/?y8/?y9/?y10/?y11;
Note:
If you set it X7/???/$1/$2/$3 (so it will be compatible with X4 syntax), so ??? - no matter (it is a placeholder for a creature type)
$1 is an attack bonus
$2 is a defence bonus
$3 is a damage (low and high) bonus.
Y$1/$2/$3/$4
Give, remove or adjust blessings and curses.
  $1 - number of curse from 1 to 65 (Format BC)
  $2 - the power of curse (0 for affects 1,3,8,22..62; number of slot (Format AP, -1 for random) for Lock)
  $3 - the length in days of the curse
  $4 - what to do
        1 = set
        2 = add/sub
        0 = del *

Comments:
  - Every hero can have only one curse of each type. So when you add/sub (sub is addition of negative value), that means that the power and the length will be changed to a sum of old and new values. If you del the curse, the power and length parameters do not matter.
  - If the slot to be locked has an artifact, it will be hidden and appear at the same place when curse has gone.

* if delete curse does not work with the command above, use next:

How to safely remove a curse (author: gamecreator):
<script type="erm">
!?FU1; correct curse removal
; x1 = curse number
; x2 = hero number
!!VRy1:S0; index
!!UN:C7688945/4/?y2; get curse field (usually 0x27FE810)
!!UN:C7688968/4/?y3; get hero field (usually 0x27FE814)
!!UN:C7688927/4/?y4; get maximum number of curses
!!FU&y1>=y4:E; no curses left, nothing found -> exit; cycle start
!!UN:Cy2/4/?y5; get current curse number
!!UN:Cy3/4/?y6; get current hero number
!!if&x1=y5/x2=y6:; right curse found
    !!SN:E7689874/1/x2/x1/y1; cdecl 0x755692(int hero, int curse, int index)
    !!HEx2&v1=0:Yx1/0/0/0; if the function worked, remove curse info
    !!FU:E; end function
!!en:; this block exits the function, el is not needed
!!VRy1:+1; next curse
!!VRy2:+20; 0x14 - struct size
!!VRy3:+20; 0x14 - struct size
!!SN:G4; go to cycle start</script>
<script>