erm358

Upload: sara-dean

Post on 03-Jun-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 ERM358

    1/57

    New ERM for 3.58 - October 21, 2004

    FLAGS:

    System Flag changes and additions:

    1) Flag 996 is automatically cleared (set to False) when any !!LE command executes and is set to 1 (True) if there is no Placed Event at the location specifiedby the LE command (you know that a Placed Event is removed after usage sometimes).

    Flag 997 and 998 are set as follows:

    2) Flag 997 returns the MP state of a battle.=0 (False) if we have a local battle=1 (True) if we have a network battle

    Then if Flag 997=1, thenFlag 998=0 if an AI attacks a Human player at a distant PC Note that the battle here runs at only ONE PC, but this PC is a distant one for the current active PC.Flag 998=1 if we have a Human vs Human battle. Here we have a real MP battle.

    You may use both flags in BA0 or BA50 trigger like this:

    !?BA0&997/998;... Here we go if this is a Human vs Human MP battle

    3) For the previous two system Flags (already mentioned in ERM Help), here's a summary of their meanings:

    Flag 999 means "Is the User sitting before a screen the Current player?" Flag 999 is set to 1 (True) if the current player (when trigger worked out) isa player "here" and 0 (False) if he or she is at another (remote) PC. For example, a mouse click trigger activated during another player's turn.For the AI, Flag 999 will always be 0. If flag 999 is set, you can be sure that

    this is a human and he is here. Flag 999 is working for all triggers

    Flag 1000 is a Human/AI owner check and also real versus theoretical battle check. =1 (True) - Human =0 (False) - AI

    For battle triggers (e.g., !?BA0, !?BG, !?BF, !?BR, etc.) Flag 1000 is a checkfor a real vs. theoretical AI battle. If Flag 1000=1 (True), it means there's areal battle (at least one human opponent). If Flag 1000=0 (False), it means that it's a theoretical AI-only battle.

    VARIABLES:

    1) Trigger-based local variables:

    y-1...y-100 are integer variables e-1...e-100 are floating point variables

    You may use them in the same places that you use y and e variables now.

  • 8/12/2019 ERM358

    2/57

    Specific features:1. They are NOT saved in the saved game. Actually every trigger section will runcompletely and you cannot save and load a game being inside a trigger section.2. These variables are local for every trigger and if even one trigger works outinside another trigger section, they will have a different set of variables. Asyou can see you cannot pass values from trigger to trigger using these variables.3. All variables are set to 0 at any trigger start, so you can use this as a default value.4. All functions called from a particular trigger can access and share that trigger's set of variables, since they're trigger-based and not function-based.

    2) New hero variables (now there's 200): w101..w200 These work everywhere that the first 100 w variables work except for one exception: !!HT:W There you can use only the first 100 w variables.

    NEW TRIGGERS:

    BA52, BA53, CM5, GM0, GM1, MF1, MG0, MG1, MM0, MM1, MR0, MR1, MR2, PI, SN, TH0, TH1

    1) Two new triggers for start/end of battle: !?BA52; !?BA53;

    !?BG and !?BF work at both sides and if the variables are the same, they willgive you the identical effect at both sides. Only user related actions are not synchronous for both sides and BA0/BA50 andBA1/BA51 triggers make a difference.

    New BA triggers:!?BA52 - called at a battle start at both sides!?BA53 - called at a battle end at both sides So at a battle start:1. If it is an attacker's PC (or non MP game) BA0 is called2. If it is a defender's PC BA50 is called

    3. BA52 is called. At battle end:1. If it is an attacker's PC (or non MP game) BA1 is called2. If it is a defender's PC BA51 is called3. BA53 is called.

    This means that if you want to have an identical code for BA0 and BA50, you just need to make one section with BA52 header.

    NOTE. If you want to test scripts in MP mode you cannot do it at the first game turn (day one). You need to pass one day so all players will have an identicalenvironment.

    2) New trigger for left-mouse click on the adventure map: !?CM5; It may be used with all CM receiver commands that you use for right mouse click: T, S, I, F, A, P, R.

    3) Two new Triggers for Saving/Loading: !?GM0; !?GM1; !?GM0 - is called right after loading a saved game but before showing the map. !?GM1 - is called right before saving the game but after choosing the game tosave.

  • 8/12/2019 ERM358

    3/57

    Example:**********ZVSE!?GM0;!!IF:M^Loaded^;

    !?GM1;!!IF:M^Saving^;**********Comments: !?GM1 will also be called every time the game performs an autosave (i.e., eachday after pressing the End Turn button). If you wish to prevent this for some reason, you can disable the autosave with the UN:J5 command. Normally this isn'tadvisable, however, as the autosave provides an important backup for the playerin case anything goes wrong.

    4) New trigger for a stack taking physical damage: !?MF1;!?MF1; (before an action)

    5) Two new triggers for spell casting on the adventure map:!?MG0; - pre trigger!?MG1; - post trigger

    Sequence:- player clicks the "cast spell" icon- !?MG0; works out (you can adjust current hero spells)- Magic Book appears and a player chooses a spell- Spell casting- !?MG1; works out (the cast spell number is stored in v997) Example:************ZVSE

    !?MG0;!!IF:M^Magic is ready to cast^;

    !?MG1;!!VRy-10:Sv997;!!IF:M^Magic was cast. Spell number: %Y-10^;************

    Comments: This doesn't work for AI heroes, only human players.

    6) New Trigger for control over scroll text during a battle: !?MM0; (or just !?MM;)This trigger works when WoG is trying to show hint text in the scroll field (e.g., "fly here").

    Comments:The !?MM0 trigger only functions prior to an action being chosen. So, for example, if I cast a spell, the display hints that show up while choosing a target don't occur within the !?MM0 trigger at all. Once the target's been chosen and thespell's been cast, it returns to using the !?MM0 trigger until the next action is taken.

    7) New Trigger for town screen when you move the mouse over an object: !?MM1;

  • 8/12/2019 ERM358

    4/57

    Now you can trigger ERM code when a player moves the mouse pointer inside the town screen. It will work when you go over a section and when you go off a section.

    This trigger works out after standard behavior (usually hint text displaying).

    8) New Combat Triggers for Stack Resistance ERM control: !?MR0; (or just !?MR) and !?MR1;

    !?MR0; works out just before calculating a resistance correction for a stack.And !?MR1 works out after calculating. So here is the sequence: - we have a basic damage from a spell (M,S,D); - !?MR0 is called (M,S,D,F[=D]); - WoG calculates a standard resistance correction (S,M, D->F); - !?MR1 is called (M,S,D,F); - end of correction (F). Here M means a monster type, S means a spell number, D means the basic damage,F means the corrected damage. Standard WoG correction function calculated F from D and returned it.For creatures that have no resistance F=D.

    9) New Trigger for Dwarf-style Magic Resistance: !?MR2; !?MR2; will work out when the game calculates dwarf-style magic resistance. You may use !!MR and other triggers. !!MR:N, !!MR:M works as before (described in !?MR0 and !?MR1 triggersection). The !!MR:F here is used as a percentage (0..100) of a chancefor the spell to work. Example:**********ZVSE!?MR2;!!MR:F0; all creatures are completely immune to all**********

    10) New trigger: !?PI;

    Post Instruction.

    This trigger works out a bit later than instruction are executed butafter the majority of settings are done for the map. The other specific thing here is that this trigger works out ONLYif you start a new game but not if you load a saved game (so the sameway as instructions do). Example:**********ZVSE

    !#IF:M^Instr^;

    !?PI;!!IF:M^Post Instr^;********** If you start this map, you will have two messages: "Instr" and then"Post Instr". When the first message appears, almost no settings aredone for the map and when the second message appears, the mostsettings are done already. If you load a saved game, you will have nomessages at all.

  • 8/12/2019 ERM358

    5/57

    11) New Trigger for sound support: !?SN;

    This triggers for any sound (WAV or M82, but NOT MP3). It triggers every time the game is trying to produce any sound. There is a corresponding receiver: !!SN.

    12) Two New Trigger for Town Hall access. !?TH#; !?TH0; is called when you enter a Town Hall !?TH1; is called when you leave a Town Hall

    Comments: 1. You could use the TH1 trigger to check for a new building built in a town. 2. You could also use it to reset the build flag with the CA:R command to allow additional building the same day.

    NEW RECEIVERS (and commands for them): CB, EA, EX, IP, MF, MM, MP, MR, SN

    1) New object receiver (Other Objects page): !!CB

    Creature Bank setup.!!CBx/y/l:... - receiver Commands: M$1/$2 - set/get/check a bonus creature type $1 and number $2 The number of bonus creatures should be >0 and

  • 8/12/2019 ERM358

    6/57

    F$1/$2; Get a number of the bonus line that has a specific ability or find the numberof the next free line.$1 - ability number.$2 - line index (-1,0...13) Comments: You may only get or check the second parameter but not set it. So the call like this is a standard:!!EA...:F65/?v100; This will return the index of a line that keeps 'A' (65) bonus ability for a creature (attack bonus). If the line is not found, it will return a line that is empty. If you set $1 to 0, you will find the first free bonus line. If $2 returns -1, there is no more room in the ability list for this creature.

    Extended syntax for EA:F command: !!EA:F$1/$2/$3;!!EA:F$1/$2/$3; $1 ia an ability type $2 is a modifier (-1 = does not matter, takes the first found) $3 is a var to store the search result.

    M$; - set/get experience multiplier The value of $ is 1000 times more than used. So for 0.75 you will get750. If you want to set it to 1, you should use M1000;

    U$; - set/get experience upgrade multiplier. The value of $ is 1000 times more than used (see M command).

    L$; - set/get an experience scale and limit.

    C$; - set/get an experience Cap. This is the maximum percent of experience that a unit can gain from a singlebattle.

    B#1/$2/..../$15; set/get an experience line. #1 - bonus line index (0...19) (you cannot "get" it) $2 - Flags. For now: 0 - ability is disabled 1 - ability is enabled $3 - ability (this is a numeric representation of a char) $4 - modifier (this is a numeric representation of a char or a number for "#..." parameter) $5 - a value for a Rank 0 (no experience) ... $15 - a value for a Rank 10 (max experience)

    A$1/$2; - set an AI modifier.

    $1 - difficulty level index (0...4) $2 - modifier This modifier is a multiplier that is used for AI hero's experience to get the resulting experience distributed to his/her stacks. It is 1 (easy), 2, 3, 4, 5 (Impossible) by default.

    S$1/$2; - set an AI modifier. $1 - difficulty level index (0...4) $2 - modifier This modifier is additional experience that is used for AI hero's experience

  • 8/12/2019 ERM358

    7/57

    to get the resulting experience distributed to his/her stacks. It is 50 (easy), 100, 200, 300, 400 (Impossible) by default.

    T$1/$2; - set an AI modifier. $1 - difficulty level index (0...4) $2 - modifier This modifier is a multiplier that is used for AI hero's experience to get the resulting experience distributed to AI town garrison stacks. If the EA:A modifier is set to 0, the town garrison experience will be 0 regardless of the valueset here. It is 10 (easy), 25, 50, 75, 100 (Impossible) by default.

    H$1 - set a human experience modifier $1 - modifier This modifier is a multiplier that is used for human control heroes to determine the experience gained by each army stack after a victorious battle. The default value is 100 (100% of the experience the hero gains from the battle).

    Comments: Settings are stored in a saved game. For A, S and T and H commands the type of monster in EA$ may be any, say, 0 because it is not used.

    P$; - Experience for the final level of an experience line. This is the experience after level 10 and to the maximum experience that a creature may have. The syntax is the same as for EX:L command, for example, i.e. EA...:P$

    Support for stack experience on the battle field. You can set experience points, experience lines and experience parameters forany creature on the battle field. Use any !!EA command for this. To refer to a stack on a battle field you needto mention a stack index in negative range:!!EA-1:... stack 0!!EA-2:... stack 1

    ..!!EA-42:... stack 41 As before you can use a positive value to apply the command to a type of creature. You may set experience parameters for any stack on the battlefield, right in BA0 (BA50) trigger sections or later during a battle.

    EA:E - set experience for a battlefield stack.E$1/$2/$3/$4; $1 - experience points $2 - modifier (as for HE:C modifier - parameter 6) $3 - creature type

    $4 - creature number You may use d modifier for $3 and $4 to not change the default creature type (will be set automatically to a correct creature type). Example:!!EA:-2:E1000/2/d/d; Set (2) experience points (1000) for creatures that are located in a stack number 1 on the battle field. Comment: You may use this command ONLY for a stack on a battlefield. So it should be !!EA-1:... !!EA:-42:...

  • 8/12/2019 ERM358

    8/57

    EA#1:D?$; - Check if experience bonus lines were copied to a stack on the battlefield. # is a stack index (reversed) -1...-42 $ a variable to get a "copied" value. Comments: If $ returns 0, the settings are taken from a default creature type bonuses and were not copied to a temporary BF settings for this stack. Actually it may happen if you summon a stack. If $ returns number 1...7, the stack bonus lines was copied and that was a stack 0...6 in an attacking army. If $ returns number 8...14, the stack bonus lines was copied and that was a stack 0...6 in an defending army. If $ returns -1, this is a stack that was not in an attacking or defending army but bonus lines for it were copied already. So if you summon a stack and use this command, it returns 0 (bonus line was not copied). If then you use any command of EA:MULPCBO to not check but set anything for this particular stack and then check EA:D again, it will return -1. The typical sequence is:- check whether the bonus lines is copied with EA:D- if no, use EA:O to copy them.- now make any particular change with EA:MULPCB

    EA#:O$; - copy all bonus lines and parameters. # is a target creature type or stack. $ is a source creature. Comments: This command copies all bonus lines and experience parameters of one creature(on the battlefield or a type of creature) to a creature/stack. Example.!!EA-2:O0; This command will set all bonus lines stack 1 on a battlefield (-2) to have the bonus lines of Pikemen. Also all experience parameters (Upgrade multiplier and so on) are also copied. This command is useful if you summon a stack and you want it to have specific

    lines of another monster or for dynamic changing of any stack experience parameters. This command does not set experience points itself.

    Extended syntax for EA:O command: EA#1:O$/#2;

    Extended EA:O command. You may use it with the first syntax and also:EA#1:O$/#2; #1 - destination stack $ - source stack #2 - copying modifier 0 (default) - just copy source to destination

    1 - if destination on Battlefield (BF): - copy to destination plus all the same type of friendly stacks if destination is a standard creature index: - nothing will be done 2 - if destination on BF: - copy to destination plus all the same type of enemy stacks if destination is a standard creature index: - nothing will be done 3 - if destination on BF: - copy to destination plus all the same type of attacker's stacks

  • 8/12/2019 ERM358

    9/57

    if destination is a standard creature index: - copy to all the same type of attacker's stacks 4 - if destination on BF: - copy to destination plus all the same type of defender's stacks if destination is a standard creature index: - copy to all the same type of defender's stacks 5 - if destination on BF: - copy to destination plus all the same type stacks if destination is a standard creature index: - copy to all the same type of stacks

    R$1/$2; - Artifact support for battlefield stacks.EA...:R$1/$2 - set/check/get artifact and option $1 = artifact index $2 = artifact optionComment. For now only one artifact index ($1) is supported - 156 (banner). For now only options 0...8 ($2) are supported.

    3) New Receiver for creature stack experience: !!EX Syntax:

    !!EX$1/$2:... $1 - hero index (-1, 0...MaxHeroInd) $2 - slot index (0...6) or !!EX$1/$2/$3/$4:... $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. Commands: A$1/$2/$3; set/check/get stack info

    $1 - monster type $2 - number of creatures $3 - experience per creature 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 per creature

    Extended EX Receiver. You may also use 5 parameters.!!EX$1/$2/$3/$4/$5:...

    $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

  • 8/12/2019 ERM358

    10/57

    Comments If you use 4 parameters, the fifth one will default to "any first found". Thesearching goes in the order: heroes, towns, mines, garrisons.

    Artifact support for stack artifacts. R$1/$2 - set/check/get artifact and option $1 = artifact index $2 = artifact optionComment. For now only one artifact index is supported - 156 (banner) For now only options 0...8 are supported

    Extended syntax for stack artifacts (R command): !!EX...:R$1/$2/$3/$4;!!EX...:R$1/$2/$3/$4; $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.

    EX Receiver command for stack combining: !!EX...:C$1/$2/$3(/$4/$5/$6)!!EX...:C$1/$2/$3(/$4/$5/$6) combine stack experience

    $1 - type of source stack = 0 - hero by type $2 - hero index (-1 = current) $3 - hero's slot (0...6) ($4)- warning type (see below)

    = 1 - hero by position = 2 - town by position = 3 - mine by position = 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 ofthe 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 ofthe 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;

  • 8/12/2019 ERM358

    11/57

    4 ) New receiver and commands to support network based battles: !!IP

    !!IP - network service for a battle. Commands: V$1/$2 - send v vars from v[$1] to v[$2] (included both) to the opponent side. R - reset random generator at both sides to the same sequence (do not use thisyet).

    Also, a new !!FU command is added: FU:D D - call a function at the opposite side. The syntax is the same as for FU:P call.

    Some descriptions. Now during a battle you may pass the values of v vars to the other side and call functions at the other side. Say, you run a user dependent script (like stack splitting). The script runs at one side because it runs as a reaction to a human action (mouse click). So allthat you change at this side will not be changed on the other side. Now you can pass all changed values to the other side not running a script there. Example.On the one side you run a mouse event driven script:

    ...!!VRv1234:S999;On the other side v1234 will still keep the old value. To fix it use:...!!VRv1234:S999;!!IP:V1234/1234; The last command will immediately send the value of v1234 to the other side. Now to the second part of the problem. Say you use some specific command thathas some effects on the battlefield (say you cast a spell with ERM). Again, if it is done only at one side, there will be a problem because it is not done on the other side. Now you may use a distant call for those cases. Thismeans that you call a function but it runs not at this local PC but at a distant

    one (the opponent's PC). Up to 16 x parameters are transferred. Example.On one side you have:...!!BMv10:Mi/y5/5; To make it run correctly you should make some changes:...!!BMv10:Mi/y5/5;!!FU12345:Dv10/i/y5/5;

    !?FU12345;!!BMx1:Mx2/x3/x4;

    That is all. How it works. FU:D immediately transfer all x parameters to the other side and makes a call of FU1234 there. So BMv10:M... command runs at one PCand BMx1:M... at the other PC. If you pass all in the right order, you will seethe same effect at both sides. Note that you can pass some vars with IP:V command and then call FU:D to passmore than 16 x parameters to the other side.

    Now, an example that you can check (tested):***********ZVSE

  • 8/12/2019 ERM358

    12/57

    !?BG0;!!IF:M^Hi!^;!!VRv99:S99; !!VRv100:S100; !!VRv101:S101;!!IP:V99/100;!!FU123:D1/2/3/4/5;

    !?FU123;!!IF:M^V99=%V99, V100=%V100, V101=%V101, X1=%X1, X2=%X2, X3=%X3, X4=%X4, X5=%X5^;*********** You will see "Hi!" message at any action of a stack, then you will see a message "V99=99, V100=100, V101=0, X1=1, X2=2, X3=3, X4=4, X5=5" at the other PC. Then you get "Hi!" at the other PC. If you continue, you may notice that the next time the message will be: "V99=99, V100=100, V101=101, X1=1, X2=2, X3=3, X4=4, X5=5". So v101 is changed. This is because first you send v99 and v100 through the network and call a function that shows a message (and this is whyv101 is 0). But then the BG0 trigger will work out at the defender's side and v101 will be set to 101. This example is only an example because in the script:!?BG0;!!IF:M^Hi!^;!!VRv99:S99; !!VRv100:S100; !!VRv101:S101;

    will work fine (identical) at both sides. But if you run a script as a reaction to a human related event (mouse click generally), you need to think how to transfer changes to the other side.

    Command to transfer W vars during a battle: !!IP:W$1/$2/$3;!!IP:W$1/$2/$3; - Transfer hero based W vars $1 - hero index $2 - first W var index to transfer $3 - last W var index to transferAlso!!IP:F$1/$2; - transfer flags $1 - first flag index to transfer $2 - last flag index to transfer

    Command to set a player-receiver of your !!IP transfers: !!IP:D$;

    Syntax: !!IP:D$; $ = player index (-1 = all) Comments. Now you may transfer vars and call distant functions not only during a battlebut also on the map. So to point who you send the vars/call functions to you should set the destination player with this command. This works the same way as for hero's w vars. So if you set !!IP:D, it will be the same until you (or someoneelse) changes it.Note that if you save and then load the game, the state of the destination playe

    r is undefined so set it in every trigger that sends data. Note also that if you send to all players (-1), all sent vars and distantly called functions will run at every PC in the game even in the current one. So first it runs through all players one by one and the last player sends it to sendinginitiator. This is a good way to inform all sides about specific changes.

    5) New receiver for a stack taking physical damage: !!MF

    Syntax:

  • 8/12/2019 ERM358

    13/57

    !!MF:XXXX;

    Commands: N$ - a stack number (0...41) D$ - a damage F$ - a corrected damage E$ - enable (1)/disable(0) taking a damage W$ - get/check a type of attacker $ = 2 - tower shot = 1 - moat = 0 - other

    Comments: You may check a stack number to get detailed info on this stack. Damage and a corrected damage keep the same value on trigger switching (first!?MF1 trigger section). We recommend not to change the D$ value for it is the initial damage that the game wants to apply to the stack and if you have more thanone !?MF1; trigger section, this command may be used to find the initial damagevalue. Instead you can set a new damage value with the F$ command. Anyway, thereal damage that is used by the game after the trigger works out is taken from the F$ command. You may ignore the damage completely by using the E$ command (itis enabled by default).

    To simulate a block ability with ERM you can use a !?MF1; trigger, calculate a

    chance to work out, disable damage with !!MF:E0; command, show the block animation with !!BM:Q84; (set a bit "took a defense action", if you want) and add a corresponding message to the battle log with !!MM:Sz#; command.

    6) New Receiver to Get/Set/Check scroll text during a battle or Get the positionof the mouse on the battlefield: !!MM

    Syntax:!!MM:$;

    Commands: D$ - Get or check the current position (code) that a mouse moves over (same as

    the CM:D command). You can set this value too but we don't know what will happen (maybe nothing).

    Mz# - Get/Set/Check the message displayed in the scroll bar. z# is a z variable to set or store a message.

    Example:!?MM0;!!MM:M?z5;!!MM:D?i;!!VRz10:S^P:%Vi M:%Z5^;!!MM:Mz10;

    This will show the position and original message when you move the mouse overa battle field.

    Sz# - add a message to the battle log.

    7) New Receiver (MP3 Control): !!MP

    Command:

  • 8/12/2019 ERM358

    14/57

    S#/^filename^; S#/$; where $ is the index of a z variable

    Sets a custom MP3 file to play instead of predefined or user defined game music.

    # is from 1..199 and the complete list is below.

    Comments: Do not include the extension ".mp3". This is added automatically.

    Example of setting a custom music file named "Code.mp3":

    ZVSE!?OB6/6/0; // visit something at 6/6/0// Set Castle music to Code.mp3 in DATA folder!!MP:S1/^..\data\Code^;

    If you put an mp3 file in the mp3 folder, you do not need to mention a folderitself:!!MP:S1/^Code^;

    Or if you have a file in the maps folder:!!MP:S1/^..\maps\Code^;

    8) New Receiver for Stack Resistance ERM control: !!MR

    Syntax:!!MR:XXXX;

    You may call it ONLY from inside !?MR trigger sections.

    Commands: M$,S$,D$,F$,N$.

    M$ - monster type. (Format C).

    Comments: Usually you can use it for getting the number but you can also set the value (

    make sense only in !?MR0 trigger) to simulate the resistance (actually there isonly golems resistance and Elementals sensitivity).

    S$ is a spell number. (Format SP).

    Comments: Again, most useful to get the index but if you set it in !?MR0, you can adjustElementals sensitivity, for example. The basic damage is calculated before thetriggers work so changing the spell number does not change the damage.

    D$ is the basic (without resistance) damage.

    Comments: This may be got or set. Both make sense. If you change this in !?MR0, your value will be used as a basic spell damage for the creature by resistance calculating routine.

    F$ is the final (corrected) damage.

    Comments: If you check it in !?MR0, it will be equal to D$ value. Setting this value in!?MR0 makes no sense for this value will be set by resistance calculating routin

  • 8/12/2019 ERM358

    15/57

    e. Though it is very useful to be set in !?MR1. Using this way you can ignore adefault WoG resistance and set yourown value that will be returned as a final damage applied to the creature stack.

    N$ is a stack number on the battle field (0...41).

    Comments: You can only get this value. There is a VERY IMPORTANT thing here! You know that the AI calculates losses without real battle if no human player takes part inthe battle. Moreover, the AI calculates possible battles every AI hero step toestimate whether it may attack a human hero or not. This means that this commandwill work ONLY if there is a real battle (even if it is a quick battle, it IS areal battle). You know that we have flag 1000 in !?BA trigger to determine a real battle. So all that was said about !?BA trigger is identical for !?MRtrigger. Anyway, there is a check and you will get a syntax error if you try touse N$ command not in the real battle.

    9) New Receiver sound support: !!SN

    The SN Receiver lets you play external or internal sound files at almost any type.Attention! If you try to play a sound, !?SN trigger will occur. So you can substitute even a sound played by ERM.

    There are some limitations. First, sound files cannot be longer than 10 seconds.Longer sound files will only play the first 10 seconds of sound. Second, when the game tries to play a sound it checks whether it is already being played now.If yes, it just runs another copy. If no, it loads the sound again. To search for the name it uses only the first 12 characters, assuming that the file is DOS based 8.3 and is located in the DATA folder. So if you expect that the sound is played rarely, it is not a problem at all, otherwise check it first.

    Commands: S$ - Get/Check/Set the sound file name to a z variable (Format SN). Pz# - Play a sound file now named z#.

    Here is a short tour of how to change sounds for objects. For example, we may want to change a sound when we visit a learning stone. First we need a file with a new sound. We'll use a sound file named 1.wav in this example. Then we need a "silent" file to avoid "resource not found" message(you may find the ZQUIET.WAV file in the data folder). Now place some learning stones on the map and add an ERM script:***************ZVSE!?OB100; visit learning stone!!VRz10:S^..\data\1.wav^; external WAVE or 82M file!!SN:Pz10; Play it now !

    !?SN; sound trigger

    !!SN:S?z-10; store a sound file name!!VRi:S0; !!VRz-9:S^Gazebo.wav^; !!VRi&z-10=z-9:S1; learning stone?!?SN&i=1; continue if learning stone!!VRz-10:S^ZQUIET.WAV^; nothing just silence!!SN:Sz-10; shut up !

    NEW COMMANDS FOR EXISTING RECEIVERS:

  • 8/12/2019 ERM358

    16/57

    AR, BA, BM, BU, CA, CM, CO, DO & FU, DW, HE, IF, LE, OW, TR, UN, VR

    NEW FORMAT FOR AR RECEIVER: !!AR$:XXXX;

    New style for AR receiver - indexed.- coordinates are in v[$],v[$+1],v[$+2]

    NEW BA RECEIVER COMMANDS: Q, S

    1) New BA Receiver command to control Quick Combat battles: !!BA:Q$;

    !!BA:Q$ - set/check/get Quick Battle flag. $ = 1 if quick battle is enabled and 0 if disabled.

    2) New BA Receiver command to check for a siege battle: !!BA:S$;

    !!BA:S$; get/check siege battle type $ - type = 0 - ordinary battle = 1 - siege battle with Fort = 2 - siege battle with Citadel

    = 3 - siege battle with Castle Comment. You may not set this parameter.

    NEW BM RECEIVER COMMANDS: U1, U2, U3, U4, U5, V

    1) Three New BM Receiver commands for setting monster stats:

    !!BM...:U1/$; - get/check/set stack's minimum damage!!BM...:U2/$; - get/check/set stack's maximum damage!!BM...:U3/$; - get/check set stack's number of shots

    2) New BM Receiver command to change a spell to cast for a creature: !!BM..:U4/$;

    !!BM...:U4/$; This command may be used for monster spell checking and changing. Comments: You may only change the spell for creatures that cast spells already but you should choose a spell of the same kind. For example, if a creature normally castsa spell on a friendly unit (say Ogre Magi's Blood Lust), you may change it to any other single-stack beneficial spell (say Mirth or Haste) but not to another type of spell (such as Slow or Magic Arrow), otherwise the AI will never use it.However, if you only need a human player to be able to cast the spell with that

    creature, almost all spells will work. This example also "fits" a Commander case. They are set to cast spells like Ogre Magi. So to make a "monster" Commander cast spells you need to set it to anycorrect value. Also note that this command has no effect on creatures whose spell is determined randomly each round, such as Master Genies and Faerie Dragons.

    3) New BM Receiver command to return the index of a cloned stack (clone spell cast through ERM): !!BM#:U5/$;

  • 8/12/2019 ERM358

    17/57

    !!BM#:U5/$; $ - index of this stack's clone. If there is no clone for this stack, it returns -1, otherwise it returns 0...41 - a number of the stack that IS a clone of this one. BTW, you can set it. So if you clone a stack and then reset this field to -1,the cloned stack will not be a clone of this one.

    4) New BM Receiver command to show combat animations: !!BM#:V#;

    !!BM#:V#; # is a number of animation (Format AC) This will show the animation on the stack.

    NEW BU RECEIVER COMMANDS: G, M, V

    1) New BU Receiver command to control special terrain modifiers: !!BU:G$;

    Get/check/set the special terrain type and terrain modifier in combat.

    Command syntax:

    !!BU:G$;

    -1 - no modifier0 - coastal battle (does not attend a battle)1 - Cursed Ground2 - Magic Plains3 - Holy Ground4 - Evil Fog5 - Clover Field6 - Lucid Pools7 - Fiery Fields8 - Rocklands9 - Magic Clouds

    Comments: If you set it BEFORE the game sets a background image for a battle, this willuse this value to pick up a corresponding background. If you change it during a battle, you will affect the rest of the battle.

    2) New BU Receiver command to add a new scroll text message: !!BU:Mz$;

    Command syntax:!!BU:Mz# - adds a message to the combat

    Comments:

    This differs from MM:M in that MM:M just shows the message and does not add it to the list while BU:M shows it and adds it to the list so you can use the up anddown arrows to scroll the combat message window view and find the message later.

    Also note that additional text can be displayed with this command, (for an action or whatever), but you can't actually replace the original text; it's going toshow up regardless.

  • 8/12/2019 ERM358

    18/57

    3) New BU Receiver command to win a battle: !!BU:V$;

    BU:V$; win a battle $ mean the side to win (0=right (defender), 1=left (attacker)) This will end the battle and the chosen side wins. As you can see, this command may also be used to lose a battle.

    NEW CA RECEIVER COMMANDS: B6, I, R

    1) New CA Receiver command to build in town using an internal function: CA...:B6/#;

    !!CA:B6/#; # - building number to build. Builds a building in a town using an internal function.The syntax and the meaning is the same as for CA:B1/# but because it uses an internal function, buildings with multiple levels will be built correctly, and mageguilds will have spells automatically added (although you can still change them).

    2) New CA Receiver command to set the external appearance of a town: !!CA...:I$;

    Command Syntax: !!CA:I# - sets the external town appearance. You can use only set syntax. Others make no sense.

    Values for #: 0 = default (synchronizes the look with built structures, e.g., a Fort or Capitol) -1 = completely destroyed 1 = destroyed a bit 2 = destroyed more 3 = destroyed a lot

    3) New CA Receiver command to control town building flag: !!CA...:R$;

    Check or set if a player can build this turn in a town.!!CA...:R$; $ = 0 if player/AI may build this turn $ = 1 if player/AI may not build this turn (already did) Comment: You may use R0 any number of times during the turn and thus build any number of buildings in a town.

    NEW AND UPDATED CM RECEIVER COMMANDS: I, M

    1) Updated CM:I command:

    Now the CM:I command should always return a correct value in the town screen fortown buildings, even if one structure overlaps another. Also it is set now to -1 if no structure is found under the cursor.

    2) New CM Receiver command to set hint text in the town screen: !!CM:Mz#;

    Command Syntax:

  • 8/12/2019 ERM358

    19/57

    !!CM:Mz# - this command can be used to set the hint text in the town screen, replacing the default hint with your own. You can use global (z1..z1000) or local(z-1..z-10) z variables.

    CommentsTo get additional information on where the mouse is situated, you can use other!!CM commands: T, S, I, F, A.

    Example:!#VRz10:S^Hi, fellow!^;!?MM1;!!CM:Mz10;

    NEW CO RECEIVER COMMANDS: A1, A2, A3, A4

    1) CO:A - Commander artifact support A1/#1/#2; Add a Commander artifact by type #1 - artifact type (from 146...155) #2 - number of won battles Results: v1=0 - artifact added v1=1 - not a Commander artifact

    v1=3 - Commander has this artifact already v1=4 - no free slot

    A2/#1; Remove a Commander artifact by type #1 - artifact type (from 146...155) Results: v1=0 - artifact is removed v1=1 - Commander does not have this artifact

    A3/#1/$1/$2; Control a Commander artifact in a slot #1 - artifact slot (0...5) $1 - artifact type (from 146...155) $2 - number of won battles

    Results: You may get/check or set artifact and/or number of won battles. No additional checks is made for artifact type so be careful to avoid incorrect types or duplication.

    A4/$1/$2/$3/$4/$5/$6/$7/$8/$9/$10/$11/$12 Control Commander artifacts in allslots $1 - artifact type (from 146...155) in slot 0 $2 - number of won battles for art in slot 0 $3 - artifact type (from 146...155) in slot 1 $4 - number of won battles for art in slot 1 $5 - artifact type (from 146...155) in slot 2 $6 - number of won battles for art in slot 2

    $7 - artifact type (from 146...155) in slot 3 $8 - number of won battles for art in slot 3 $9 - artifact type (from 146...155) in slot 4 $10 - number of won battles for art in slot 4 $11 - artifact type (from 146...155) in slot 5 $12 - number of won battles for art in slot 5 Results: You may get/check or set artifacts and/or number of won battles. No additional checks are made for artifact type so be careful to avoid incorrect types or duplication.

  • 8/12/2019 ERM358

    20/57

    Comments: May not be applied to all Commanders (-2).

    USING COMMANDERS WITH ERM: All Commanders that will be placed on a map with ERM will have the same primary and secondary skills and the same statistic (but ability depends on a type ofthem). Actually it is one Commander that may have many looks. If you do not set any parameters for such Commanders, they will have default game start up parameters. So if you want it more powerful, use the CO receiver. To apply all changes to only these additional Commanders use index -3 (all Commanders at attacking side) and -4 (allcommanders at defending side). In order to make it into a "real" Commander you must set it to "alive" with the CO receiver and you should also set its type. You can give any Commander special abilities or set any Commander stats as you would for a normal Commander.If you DON'T set a Commander to alive with the CO receiver, it will instead bea "monster Commander" and will always have Fly and Shooting abilities. Stats andother abilities for these "monster" Commanders must then be set with other ERMcommands and not the CO receiver. Note, that you can set all in the BA0/BA50 trigger section or later in the battle. All settings will be lost after a battle and will not be saved in the savedgame.

    Also, to be sure that all goes fine, please place a corresponding set of Commanders at attacker's side (174...182) and defender's side (183...191).

    NEW DO AND FU RECEIVER SYNTAX AND NEW FU COMMAND:

    1) FU and DO Receivers have extended syntax to provide return values.

    Now you may use "?var" syntax to return values from the call. You can use a v, y- or y variable to store the return value. Say:!!FU...:Pv1/v2/v3/?v4; Now if you change x4 value inside of the function, say:

    !!VRx4:Sx1; it will be copied to v4 after function return.

    Comments: The value of the variable itself (v4) is not transferred to x4 at a function call. Instead the index of the var is transferred (so x4 will keep value 4). In DO loop the index value (4) will be passed at every iteration.So if you set it inside of the function body, it will be copied to the variable-receiver after the end of the iteration and restored to index value at the beginning of the next iteration.

    Also you may use "=var" syntax to set (parse) the value at every DO loop iteration (make no difference with standard "var" syntax for FU call).

    Say:!!VRv35:S10;!!DO...:P=v35; Now if you change the v35 inside of the loop body it will be passed to the next iteration taking account changes made for v35:!!VRv35:Sx1+1; So now it gives you x1 equal 10,11,12,13... at every iteration. If you use the standard syntax:!!VRv35:S10;!!DO...:Pv35;

  • 8/12/2019 ERM358

    21/57

    you will have x1 = 10,10,10,... at every iteration.

    Comments: You may use any number of such variables in the call. You may use the same var (see example below) with ? and = syntax.

    Example 1:!?FU2;!!VRx2:Sx2+17;!!VRx3:Sx1+17;

    !?FU1;!!FU2:P13/?y-1/?y-2;

    !#IF:M^%Y-1,%Y-2^;!#FU1:P;!#IF:M^%Y-1,%Y-2^;

    You will see "0,0" and then "16,30".

    Example 2:!?FU2;!!VRx2:Sx1+17;!!IF:M^x=%X1^;

    !?FU1;!!VRy-1:S33;!!DO2/1/20/1:P=y-1/?y-1;

    !#FU1:P;

    You will see 33,50,67...

    2) New FU receiver command for network battles: D

    D - call a function at the opposite side. The syntax is the same as for FU:P c

    all.

    See the IP receiver description for more details and examples.

    3) New FU receiver command to check for wrong y vars usage: C

    !#FU:C$; It will check only if you try to set a y var outside of a function body (execution time), for this is the main case of the problem (reading is not a problem at all if it worked correct). By default the checking is disabled. Syntax:

    !#FU:C$; enable/disable wrong y usage check. $=0 - enables run time check $=1 - disable run time check (default)

    This is most logical to use as an instruction and may be useful when testing scripts. Very simple usage. Example:************ZVSE!#FU:C;

  • 8/12/2019 ERM358

    22/57

    !#TM1:S1/999/1/1; set TM1 for red

    !?TM1;!!VRy1:S1;!!FU123:P;

    !?FU123;!!VRy1:S2;************ Here when the timer section is executed, you will get a message that y var is set outside of the function body.

    EXTENDED DW RECEIVER COMMAND: O

    1) Extended DW:O command passes control of a dwelling to another player.

    !!DWx/y/l:O$/1; pass control over a dwelling to another player $ = is a new owner. The second parameter is a dummy but use 1 there.

    This syntax changes the owner plus calls an internal structure to adjust all g

    rowth numbers for the previous and a new owner. It should also work correctly inMP mode.

    NEW, EXTENDED, AND UPDATED HE RECEIVER COMMANDS: A1, B0, B3, C0, C1, C2, G, O, R5, R6, S, X

    1) Extended HE:A1 command now supports backpack slots: 19..82 are backpack slots.

    2) Updated HE:B0/$ command:

    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 Orin "Orin II", it will still display Orin's default biography.

    3) New HE Receiver command to read a hero's default biography: !!HE:B3/?$;

    !!HE:B3/?$; 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:

    !!HE0:B3/?z25; This will store Orin's default biography in the z25 variable.

    4) Extended !!HE:C0, !!HE:C1 and !!HE:C2 syntax for setting or retaining StackExperience.(Note: does not work with HE:C).

    Now these commands may have 5 or 6 parameters:!!HE...:C#/#1/$2/$3/$4/$5

  • 8/12/2019 ERM358

    23/57

    $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=1666Ex: 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 systemthinks 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 newcreatures. 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 creaturetype 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) plusnew 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.

    Ex: 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 M

  • 8/12/2019 ERM358

    24/57

    onks and add 3000 experience with Mode 3, the result is: 1000+3000=4000.Ex: 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 theexperience 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 2000 experience, and you add 1000 experience, it will have 2000+2000+1000=5000. Then if you addanother 1000 experience it will have 5000+5000+1000=11000.

    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 t

    o $4 levels.Experience is not distributed. So if you have a stack of 10 Monks with Exp 1000,and wantto 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+dEEx: 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.Ex: 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.Ex: HE...:C0/0/d/d100/5/10; Add to the stack 100 creatures with exp of Rank 5.

  • 8/12/2019 ERM358

    25/57

    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).

    Ex: 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).Ex: 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 newtype 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 oldcreatures 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.Ex: 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). Ex: HE...:C0/0/../d/3/14;

    The new stack gets the corresponding experience that the old stack had plus 3levels (ranks) of exp.

    5) New HE Receiver command to set initial hero's movement points: !!HE#:G$;

    !!HE#:G$; $ - initial hero's movement points. Comment: If you set both HE:W and HE:G options to the same value (any), you may dig forthe Grail.

    6) Extended HE:O command syntax to use a "neutral" hero in a battle.

    Use a dummy second parameter in HE:O command (like HE...: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, butmake sure that the owner is changed back to -1 after the battle is over. Note: if you change an unowned hero in this way to temporarily give it an owner (number0..7), it can be read with HE:O, but BA:O will still return -1.

  • 8/12/2019 ERM358

    26/57

    7) New HE Receiver command to set maximum morale: !!HE:R5/$;

    $=0 - Maximum Morale not set. $=1 - Maximum Morale is set.

    8) New HE Receiver command to set maximum luck: !!HE:R6/$;

    $=0 - Maximum Luck not set. $=1 - Maximum Luck is set.

    9) Extended HE:S command to control a Hero's secondary skill sequence: !!HE#:S$1/$2/1;

    Check or set the sequence of a Hero's secondary skills:

    Syntax: !!HE#:S$1/$2/1; $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.

    10) Extended HE:S command to control the number of skills displayed: !!HE:S$;

    Check or set the number of known skills that are displayed: Syntax: !!HE:S$; $ - 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.

    11) Extended HE:X command to control specialty settings: !!HE#:X$0/$1/$2/$3/$4/$5/$6;

    !!HE#:X$1/$2/$3/$4/$5/$6/$7; - get/set/check all speciality settings. $1...$7 - parameters.

    Speciality types (defined by $1)

  • 8/12/2019 ERM358

    27/57

    $1=0 Secondary skills $2=secondary skill number ($3...$7 ignored, preferably 0)

    $1=1 Creatures $2=creature type number ($3...$7 ignored, preferably 0)

    $1=2 Resources $2=resource type ($3...$7 ignored, preferably 0)

    $1=3 Spells $2=spell number ($3...$7 ignored, preferably 0)

    $1=4 Creatures extra $2=creature type number $3=attack bonus $4=defense bonus $5=damage bonus ($6...$7 ignored, preferably 0)

    $1=5 Speed and other

    $2=subtype ($3...$7 ignored, preferably 0)

    $1=6 Upgrades $2=creature 1 to upgrade $6=creature 2 to upgrade $7=creature to upgrade to ($3...$5 ignored, preferably 0)

    $1=7 Dragons $2=no matter (it is a placeholder for a creature type) $3=attack bonus $4=defense bonus

    $5=damage (low and high) bonus ($6...$7 ignored, preferably 0)

    $1=8 Extra WoG speciality $2=subtype ($3...$7 ignored, preferably 0)

    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;

    NEW AND EXTENDED IF RECEIVER COMMANDS: N, N1, Q

    1) New IF Receiver command for 8 picture message box:!!IF:N#1/#2/#3/#4/#5/#6/#7/#8/#9/#10/#11/#12/#13/#14/#15/#16; and also: !!IF:N^text^; and !!IF:N1/$;

  • 8/12/2019 ERM358

    28/57

    A message with text and up to 8 pictures of any internal types.This is the same as you can see if you set a global timed event with some resources. The syntax is:!!IF:N...; If you set more than 3 parameters, the interpreter treats it as pictures types/numbers the same way as for the IF:Q dialog. You may set up to 8 pictures (16 parameters) and minimum 2 pictures. No dialog is shown, just preparation phase. So:!!IF:N3/8/10/2/11/3/13/2/17/1000/21/99/22/4; means that the first picture (3/8) is a resource - sulfur with quantity 8. Thenext one is (10/2) a flag of Tan player, then Luck and so on. You can see thathere we have 7 pictures.

    Another syntax is:!!IF:N...; If you have less than 4 parameters, the interpreter treats it as a command toshow the dialog that was prepared with the previous syntax.The only parameter here is the text to display:!!IF:N^text^; - direct text or!!IF:N1/$; - z var (standard, local or extended)

    In any case, the text is parsed for any format commands and as a result you will not see something like this "Hi %Z10!" but "Hi Slava!".

    There is one limitation to the text: it can not have too many lines. This example is close to the maximum:!!IF:N^Thisisalooo...........

    ..oongText^; If you have more lines, the game crashes.

    2) Extended IF:Q command - message type "10": !!IF:Q#/.../10^text^;

    If you use IF:Q#/... command with message type 10 (choice of two pictures plusa Cancel button), the result will be stored not in the flag variable # but in the standard ERM variable (v#) but in the range of v1..v1000 only. So you will beable to take the returned value: 0 = escape pressed 1 = left picture is chosen

    2 = right picture is chosen

    NEW AND EXTENDED LE RECEIVER COMMANDS: A, B1, B2, B3, B4, N, S

    1) Extended LE functionality: Pandora's Box.

    Now you can use the !!LE receiver to program Pandora's Box.All LE commands should work. To trigger it, use !?OB trigger with any kind of syntax.

  • 8/12/2019 ERM358

    29/57

    Note: you still can't change the number of secondary skills, artifacts, or spells (same as an event), only change existing ones.

    2) Extended LE:A, LE:N and LE:S commands:

    !!LE...:A$; get the number of artifacts!!LE...:N$; get the number of secondary skills!!LE...:S$; get the number of spells You can use a set syntax but it will change nothing.

    3) Four new LE Receiver commands to control artifacts: !!LE...:B#/$;, !!LE...:B2/#/$;

    Control Artifact bonus. B1/$ - get/check number of artifacts in the bonus list (you cannot set it). B2/#/$ - get/set/check an artifact $ at position # (0...) in the bonus list. B3/$ - add an artifact $ to the end of the bonus list. B4/$ - remove artifact at position $ (0...) in the bonus list. Comments. We have the LE:A command already but it allows only to change artifacts in thebonus list. This new command lets you set, add and remove new artifacts from Lo

    cal Events and Pandora's Boxes, like the CB:A command does for Creature Banks. You can make an almost unlimited list of artifacts for any Local Event or Pandora's Box. You cannot set a spell scroll as an artifact; the game will treat it wrong andthen crash.

    NEW AND EXTENDED OW RECEIVER COMMANDS: N, O, S

    1) Extended OW:N command syntax to get town number in the town list: !!OW:N#1/#2/$;

    Now you can get a number of a town that is shown in one of 5 slots at the rig

    ht side of the adventure map in the town list:!!OW:N#1/#2/$; #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 forthe Blue player and store it in y10.

    2) Extended OW:N command syntax to move a town in the town list: !!OW:N#1/#2/#3/

    #4;

    !!OW:N#1/#2/#3/#4 - move a town in the list #1 - owner #2 - action type: 1 = move town to the top of the list 2 = move town one position up 3 = move town one position down #3 - town list slot of a town (0..4) #4 - dummy parameter (0)

  • 8/12/2019 ERM358

    30/57

    3) Extended OW:O command syntax to control all active heroes for a player:!!O#/$1/$2/$3/$4/$5/$6/$7/$8/$9/$10;

    !!O#/$1/$2/$3/$4/$5/$6/$7/$8/$9/$10;#=number of owner (-1=current) (FORMAT E1)$1 - number of heroes the owner has$2..$10 - Hero ID numbers owned by this player (-1=no hero) (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.

    4) Extended OW:O command syntax to get a hero number in the hero list: !!OW:O#1/#2/$;

    Now 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:!!OW:O#1/#2/$; #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 forthe Blue player and store it in y10.

    5) Extended OW:O command syntax to move a hero in the hero list: !!OW:O#1/#2/#3/#4;

    OW:O#1/#2/#3/#4 - move a hero in the list

    #1 - owner #2 - action type: 1 = move hero to the top of the list 2 = move hero one position up 3 = move hero one position down #3 - hero list slot of a hero (0..4) #4 - dummy parameter (0)

    6) New OW Receiver command for casting spells on the adventure map: !!OW:S; Syntax:!!OW:S#1/#2; #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 tosimulate a player clicking the "cast spell" button.

    Comments:1. No spell book is needed and the hero doesn't need to know the spell.

  • 8/12/2019 ERM358

    31/57

    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 Dooror Town Portal to work.

    NEW TR RECEIVER COMMAND: G

    1) New TR Receiver command to control special terrains (terrain overlays): !!TR...:G$;

    Command syntax:

    !!TR:G?$ - Returns the topmost terrain overlay. You may only use GET or CHECK syntax.

    21 - Cursed Ground46 - Magic Plains227 - Holy Ground224 - Evil Fog222 - Clover Field225 - Favorable Winds

    228 - Lucid Pools226 - Fiery Fields231 - Rocklands229 - Magic Clouds

    NEW AND EXTENDED UN RECEIVER COMMANDS:A, B7..B10, J1..J10, N5..N6, P, Q, R4..R7, U, V

    1) Extended UN:A command syntax for Combination Artifact management:

    Combination artifact management:

    !!UN:A#/$/#1/#2{/#3/#4/#5/#6/#7/#8/#9/#10/#11/#12/#13/#14}; Build/remove a Combo Art. # - Combo index (0...31) $ - set/check/get Combo Art Num (0...MaxArtNum) #1 - Part 1 of Combo art #2 - Part 2 of Combo art #3 - Part 3 of Combo art (optional) . . #14 - Part 14 of Combo art (optional) Results. Combo art is set up. If successful ERM Flag 1 is set to 1 otherwise to 0.

    Comments.0. You may use an instruction syntax !#UN:A1. All Combo settings are kept in a specific table. This table is extended up to32 entries. So we can have up to 32 combo arts. All standard combos are alreadyin the table (first 12 entries).2. You may check whether the table entry is empty or not:!!UN:A5/?v100/0/0; Get the combo art number in an entry 5 of a Combo Table to v100. Two zeros inthe end is needed to have at least 4 parameters. In a check/get syntax extra (zeros) parameters are ignored.

  • 8/12/2019 ERM358

    32/57

    NOTE. The empty entry in the Combo table keeps a combo art number 0.So in an example above, v100 will have 0 if the entry is empty and you can use it. You may delete a combo art without adding a new one. Use Combo Art number 0 todo it. Example:!!UN:A5/0/0/0; First 0 means remove Combo info in entry 5 of the combo table.The next two zeros are just to make sure that we have 4 parameters, no less.

    Important: only artifacts with an index below 160 may be a part of a Combo artifact although any artifact be used for the assembled combination.

    2) Extended UN:B commands for new Commander Stones: !!UN:B7..10/%;

    Syntax: !!UN:B7..10/$;

    Comments: Power Stones work as follows:

    i) Non-WoGified WoG Map without ERM, with WoG Options set to Commanders Disabled, *or* Non-WoGified WoG Map with Commanders enabled by ERM, Power Stones disabl

    ed by ERM (!#UN:P3/0; and !#UN:B7/0; !#UN:B8/0; !#UN:B9/0; !#UN:B10/0;). *or* WoGified Map with Commanders disabled through WoG Options, Power Stones option enabled or disabled.Result: Power Stones act as standard treasure chests.

    ii) Non-WoGified WoG Map without ERM, WoG Options set to Commanders Enabled, *or* Non-WoGified WoG Map with Commanders enabled by ERM (!#UN:P3/0), Power Stones enabled by ERM or NOT disabled by ERM (!#UN:B7/1; etc. -- the default for Power Stones is enabled if no UN:B commands for them is included). *or* WoGified Map with Commanders Enabled through WoG Options, Power Stonesoption

    option enabled or disabled.Result: if hero has a live Commander, Commander gains bonus from Power Stone.Result: if hero has a dead or no Commander, Option to destroy Power Stone or leave it.

    iii) Non-WoGified WoG Map with Commanders disabled by ERM (!#UN:P3/1;).Result: Power Stones act as more valuable treasure chests (up to 7500 gold/7000exp.).

    3) New UN Receiver command to control a map's hero level limit: !!UN:J1/$1/$2;

    Set/check/get a hero level limit for a map.

    Syntax: !!UN:J1/$1/$2; $1 is a level limit (you can set/check/get it) $2 is an XP amount for this level Comments: Whenever you set or get the level value, the XP amount is always for the current level limit. So if you set the level, it will return an XP for this new justset level. So to set and meanwhile get the level and level XP, you can use one command:!!UN:J1/35/?y10;

  • 8/12/2019 ERM358

    33/57

    Here you set the level to 35 and get an experience for this level to y10.

    4) New UN Receiver command to control player map difficulty: !!UN:J2/$;

    Set, check or get a player difficulty level. Syntax:!!UN:J2/$; Set, check or get a difficulty level chosen by player. If you set the level it may not always keep its value later so use with caution.

    5) New UN Receiver command to load a WoGifications setting data file: !!UN:J3/^file^;

    Lets you load an external file with WoGification settings. With this command you can customize the way a map is wogified. The loaded setting will override the settings in the WoG Options screen.

    Syntax: !#UN:J3/^the path to the file^; The path may have a folders in relative or absolute path (based onthe WoG folder), like this:

    ^MyOptions.xxx^ - a file in the Heroes home folder^maps\opt.yyy^ - a file in the maps folder^.\maps\opt.yyy^ - the same as above ("." means the current folder)^C:\xxx.yyy^ - a file in the C: root folder^..\mysets\set001.zzz^ - a file in mysets folder that is a childfolder for the parent folder for the heroes home folder (clear? :-)

    6) New UN Receiver command to control AI "thinking" radius: !!UN:J4/$;

    ERM command to set AI "thinking" radius: !!UN:J4/$; set/get/check the radius $ = 32000 is a SoD default

    = 4096 is a current WoG default This is not a number of squares to analyze, but is the total range of an AI hero based on its movement points and the terrain. For grass, one square of distance is about 100 points. This is not saved in the saved game. You can change this value at any moment, for example, making one AI player oreven a specific hero more clever than another. Caution: if this value is set too low, an AI hero may just sit there and not move at all.

    7) New UN Receiver command for to disable Autosave: !!UN:J5/$;

    Disable Autosave.!!UN:J5/$; $ = 1 enable autosave $ = 0 disable autosaveComments: The state of disabling won't be saved in a save game file, so if you need autosave to remain disabled, you should also put this command after a Load Game trigger (!?GM0). In most cases it isn't advisable to disable the autosave, because the autosaveprovides an important backup for the player in case anything goes wrong.

  • 8/12/2019 ERM358

    34/57

    8) New UN Receiver command to generate a random artifact: !!UN:J6/#/$;

    !!UN:J6/#/$; generate a random artifact of a specific level. # - (set) artifact level (-1=random, 1=no class, 2=treasure, 4=minor, 8=major,16=relic) $ - (get/check) random artifact of a level Comments: This function returns only enabled artifacts. Artifact level 1 includes The Grail, Spell Book, Spell Scroll, and all War Machines. Example:!!UN:J6/2/?v10; - get a random Treasure artifact to v10

    You can add level numbers together to cover several classes. e.g., 18=treasure& relic. If you generate more than one random artifact number from the same trigger, the artifact numbers will be unique, so you can be assured of getting a selectionof different artifacts without duplicates.

    9) New UN Receiver command to control a town's Artifact Merchant: !!UN:J7/#/$;

    Check/Get/Set Artifact Merchant's artifact

    !!UN:J7/#/$; # - slot index (0...6) $ - artifact in the slot Comments: You may use set, get or check syntax. -1 means no artifact. Example:!!UN:J7/3/?v10; - get artifact in slot 3!!UN:j7/v5/v20; - set artifact in slot v5 to v20

    10) New UN Receiver command to check if a file exists: !!UN:J8/$1/$2; or !!UN:J8/$1/^text^;

    !!UN:J8/$1/$2; or !!UN:J8/$1/^text^;Checks whether a file exists. $1 - modifier $2 - index of z var (local, standard or extended from ERT) z[$2] or ^text^ - a file name (with possible path) Return: Flag 1 set to 1 if file exists otherwise 0. Modifiers:0 - location is in Heroes home folder1 - in DATA folder2 - in MAPS folder3 - in RANDOM_MAPS folder

    4 - in GAMES folder5 - in DATA\S folder6 - in DATA\P folder7 - in DATA\ZVS\LIB1.RES folder8 - in DATA\ZVS\CMP.RES folder9 - in ERM_HELP folder The main purpose of the modifier is to not worry about path. For example, youhave a picture in a script folder. Now this is DATA\S but later we can transferthem to other folder. Using the modifier you need not know exactly where the script folder is located, you just need to use a modifier 5.

  • 8/12/2019 ERM358

    35/57

    Example: UN:J8/1/^mypic.bmp^ - checks for ..\DATA\mypic.bmp UN:J8/1/^P\mypic.bmp^ - checks for ..\DATA\P\mypic.bmp UN:J8/2/^mypic.bmp^ - checks for ..\MAPS\mypic.bmp

    Modifier 10 - an absolute path. With this modifier, the file name is the exact name with possible path. Example. If the modifier is 10 and the name is "Hello.txt", the file will be searched for in the current folder. Current folder for Heroes is most probably aHeroes home folder. If the name is "C:\Hello.txt", the file will be searched forin the root of disk C:

    11) New UN Receiver command to get a path for a file: !!UN:J9/$1/$2;

    This command gets Heroes 3 paths so you can create a full path for a file if you need, taking into account a particular player's Heroes folder location. !!UN:J9/$1/$2; The command gets a corresponding path to a z variable. $1 - modifier (the same as for UN:J8) $2 - index of z var (local or standard) Example: It copies an absolute path to the z variable. Say we have heroes installed toC:\HOMM\WOG, the command UN:J9/2/10 will copy to z[10] the next path: "C:\HOMM\W

    OG\". You can just add a name of file you want to use and then use it in any wayyou want.

    12) New UN Receiver command to output variables to WOGERMLOG.TXT: !!UN:J10;

    Use UN:J10 command at any time (writes all non-zero variables to a file).The log will be stored in WOGERMLOG.TXT.

    13) New UN Receiver command to write z variables to an external file: !!UN:N5/#1/#2/#3/#4;

    Write z variable to wog.ini file [common] section:!!UN:N5/#1/#2/#3/#4; - save z string to wog.ini file #1 - z var index of string to write string data from #2 - option index (any positive value) #3 - (optional parameter) z var index of user-defined section to use instead of [common] #4 - (optional parameter) z var index that keeps the filename (without ".INI"part) with possible path. Note: if you include parameter 4, you must also include parameter 3.

    14) New UN Receiver command to read z variables from an external file: !!UN:N6/#1/#2/#3/#4;

    Read z variable from wog.ini file [common] section:!!UN:N6/#1/#2/#3/#4; - load z string from wog.ini file #1 - z var index of string to load string data into #2 - option index (any positive value) #3 - (optional parameter) z var index of user-defined section to use instead of [common] #4 - (optional parameter) z var index that keeps the filename (without ".INI"part) with possible path. Note: if you include parameter 4, you must also include parameter 3.

  • 8/12/2019 ERM358

    36/57

    Comments: You may save and load regular or local z variables.Option index should be unique to a save/load procedure (one option number per zvariable). So if you save a z var as an option 123456, you need to load the saved value (to any other z var) using the same option 123456. The value is not stored in a saved game but is stored in an external INI file(wog.ini, if parameter 4 is omitted). You may use these commands without problemin instructions.

    So to store a variable z-1 named "The_Main_Var" in a file "My.var" in GAMES folder (section "MyLocalSettings"), with option index 4, use:!!VRy1:S4;!!VRz-1:S^The_Main_Var^;!!VRz-2:S^MyLocalSettings^;!!VRz-3:S^GAMES\My.var^;!!UN:N5/z-1/y1/-2/-3;

    15) Extended UN:P command for setting new hard-coded WoG Options: P9, P10, P900..P906

    i) !!UN:P9/$; Sylvan Centaur creation.

    $=0 - Disabled $=1 - Enabled

    If enabled, Sylvan Centaurs can be created for free by control-clicking on a stack of Centaur Captains or Grand Elves in the Hero screen (does not work in anyother screen). An equal number from both stacks is replaced with Sylvan Centaurs. Thus 10 Grand Elves plus 10 Centaur Captains equal 10 Sylvan Centaurs.

    Note: Sylvan Centaurs start at 0 experience and do not keep any stack experiencethat the Centaur Captains or Grand Elves had before combining.

    ii) !!UN:P10/$; Troop Stacks left will rejoin their owner.

    $=0 - Won't rejoin owner $=1 - Will rejoin owner

    If enabled, troop stacks left by right-clicking will rejoin their owner when they're "attacked" by that player.Note: all previous stack experience is lost when a troop stack is left by right-clicking.

    iii) !!UN:P900/$; Stack Experience. $=0 - Disabled $=1 - Enabled

    If enabled, troop stacks lead by a hero gain experience if they win the battle.Experience is equal to the experience the hero gains from the battle. When it gains enough experience, a troop stack will gain a rank and may gain bonuses to attack, defense, damage, speed, health, and special abilities. If you combine twoexperience stacks, their experience is averaged. Each stack can improve up to rank 10. Right-click on a stack's portrait in its info screen to see its currentstack experience details.

    iv) !!UN:P901/$; Stack Experience System.

  • 8/12/2019 ERM358

    37/57

    $=0 - Equal shares and each creature gains full experience. $=1 - Weighted Shares: Lower level creatures gain more than higher level creatures. $=2 - Weighted Shares: Higher level creatures gain more than lower level creatures. $=3 - Equal shares: divided by all creatures.

    Note: the stack experience system is currently tested with option 0 (the default). Other options were earlier attempts at finding the best system to use, but although rejected, they have been left in place in case anyone wishes to experiment with them anyway. If you do want to try another system (UN:P1..UN:P3), you'llneed to also set a higher experience multiplier using the EA:H command for humans, and EA:A (possibly also EA:S and/or EA:T) for AI players since experience isdivided by all creatures in the battle and thus significantly lower.

    v) !!UN:P902/$; Leave artifact on the map.$=0 - Cannot leave artifacts.$=1 - Can leave artifacts.

    This lets you enable leaving of artifacts from a hero's backpack by right-clicking on an empty map square. This is done in the same way that you leave troops.

    You may use an old option 2 (may not leave troop) and a new 902 (may leave art

    ifacts) together:

    UN:P 2 | 902 |---------------- 0 | 0 | - may leave troops only. 0 | 1 | - may leave troops or artifacts. 1 | 0 | - may NOT leave anything. 1 | 1 | - may leave artifacts only.

    vi) !!UN:P903/$; Disable cheat codes and cheat menu. $=0 - cheating is enabled. $=1 - cheating is disabled.

    Disables the cheat codes and menu (if normally enabled). If the cheat menu is enabled, it will still appear (even if disabled with this option), but clicking onmenu items has no effect.

    Note: Although cheat codes do not normally work in multiplayer games, this option will prevent players using the cheat codes and menu by loading saved games insingle player mode.

    vii) !!UN:P904/$; and !!UN:P905/$; ERM Error Message Disabling. $=0 - Error message shown as normal and P905 is set to 1 if an error occurs $=1 - Error messages are disabled but P905 is set to 1 if an error occurs.

    This is ERM Error message disabling feature. If it is 1, all error messages are disabled, but if any error happens, option905 will be set to 1. If it is 0, the message will be shown as normal and option 905 will be set to1. Moreover, if the messages are disabled, the execution of the script will not be interrupted (the current trigger section). So you may use "risky" commands. Example: !?FU...

  • 8/12/2019 ERM358

    38/57

    ... !!UN:P904/1 P905/0; disable error messages !!HE-1:N?v99; get default hero index to v99 !!UN:P905/?i; !!FU&i>0:E; leave if error

    If you use a standard version: !?FU... ... !!HE-1:N?v99;

    produces an error message if a default hero is undefined here.

    viii) !!UN:P906/$; Disable gaining of stack experience. $=0 - creatures may gain stack experience from battles (if P900=1). $=1 - creatures may NOT gain stack experience from battles.

    If you set it to 1 and the stack experience system is enabled, stacks will notgain experience from battles, but you can still give stack experience with ERM.

    16) Extended UN:Q command syntax to Win or Lose the game.

    If you use a dummy second argument, it will Win or Lose the game using a different function than before. So if you found any problems with the old function, try with the new one instead. Example: !!UN:Q0/1; to lose (for current player) !!UN:Q1/1; to win (for current player)

    17) New UN Receiver command to redraw the town screen: !!UN:R4;

    Syntax:!!UN:R4; - Redraws town screen.

    Comments:This command must only be used while inside a town screen or it may crash the game. It is primarily of use if a new visiting or garrison hero is added to a town(with ERM while in the town screen), or if new troops are added to a visiting or garrison hero (again, with ERM while in the town screen).

    18) New UN Receiver command to set the appearance of the mouse pointer: !!UN:R5/$1/$2;

    !!UN:R5/$1/$2; set mouse pointer appearance. $1 - mouse pointer type (0..4) $2 - mouse pointer subtype (0..[depends on type])

    Comments: Displaying any dialog restores the pointer to an arrow. If you set a pointer to any shape, it will be restored to a default pointer ifyou move it unless you disable pointer changing with the UN:R7 command.

    19) New UN Receiver command to set a delay: !!UN:R6/$;

    Delay command. UN:R6/$; delay.

  • 8/12/2019 ERM358

    39/57

    $ is a delay in mseconds (1000 is 1 second).

    20) New UN Receiver command to control mouse pointer: !!UN:R7/$1/$2; or UN:R7/$1;

    Some more commands for mouse control. !!UN:R7/$1/$2; may be !!UN:R7/$1; $1 - show (0) / hide (1) mouse pointer $2 - enable (0) / disable (1) later pointer changing Comments: When you visit some objects (like fishing well) when !?OB trigger works out, the mouse pointer IS disabled. So to be sure that when your long script works with hourglass pointer, you may turn it ON manually. Then if you disable pointer changing, it prevents the pointer from changing until: - starting a new game; - loading a game; - any standard message appears (may be with ERM); - any extended WoG dialog shown. So for fishing well, it may be:!!UN:R5/1/1; !!UN:R7/0/1;

    then if you want to show a message or a question:!!IF:M... disable pointer changing again:!!UN:R5/1/1; !!UN:R7/0/1; until the end of the script where you can enable pointer changing again:!!UN:R7/0/0;

    21) New faster method for UN:U command.

    Now if you use a search object syntax UN:Utype/subtype/index/varindex you canset index to -1 or -2 (it was allowed to be 1...N before). A value of -1 means it will search for the next object of a type, using the coordinates of the previously found object of the same type while a value of -2 means the same but it wil

    l search for the previous object of a type on the map, starting from the last coordinates. In the standard syntax (index=1...N), UN:U is searching for each object from the beginning of the map and skips them until the index object is found. Thus itis a long process on larger maps, especially if there are a lot of objects of the specified type. With the new syntax (index=-1 or index=-2) the coordinates returned in v[varindex]/v[varindex+1]/v[varindex+2] are used, and a search for an object of the type specified starts from the next square on the map for -1 or the previous squarefor -2, not from the beginning. This means that the process should be faster, but it requires that you HAVE NOT CHANGED the returned coordinates of the previous search in V vars. Moreover, for the first (or last) object you should use a standard syntax OR y

    ou may set V[xcoord] var to -1 for the first object or -2 for the last object (see examples below).

    If you use -1 and -2 as an index of the object to find you may move forward andbackward from the current object. You may use them in any order.

    Examples.********** It works fine!!UN:U53/-1/1/1; (get location of mine 1: v1/v2/v3)

  • 8/12/2019 ERM358

    40/57

    ...!!VRv1:S99; (change v1 to anything)...!!UN:U53/-1/2/1; (get location of mine 2: v1/v2/v3)...********** It works WRONG!!! for v1 was modified!!UN:U53/-1/1/1; (get location of mine 1: v1/v2/v3)...!!VRv1:S99; (change v1 to anything)...!!UN:U53/-1/-1/1; (get location of NEXT mine (2): v1/v2/v3)...********** It works fine!!UN:U53/-1/1/1; (get location of mine 1: v1/v2/v3)... (v1/v2/v3 are NOT modified)!!UN:U53/-1/-1/1; (get location of NEXT mine (2): v1/v2/v3)... (v1/v2/v3 are NOT modified)!!UN:U53/-1/-1/1; (get location of NEXT mine (3): v1/v2/v3)...********** It works fine!!VRv1:S-1; (start search from the first object on the map)

    !!UN:U53/-1/-1/1; (get location of NEXT mine (1): v1/v2/v3)... (v1/v2/v3 are NOT modified)!!UN:U53/-1/-1/1; (get location of NEXT mine (2): v1/v2/v3)... (v1/v2/v3 are NOT modified)!!UN:U53/-1/-1/1; (get location of NEXT mine (3): v1/v2/v3)...

    To see a demonstration of how this syntax works, the following sample script maybe used with a randomly generated XL 2 levels SoD map. It runs through all Creature banks in forward and then backward order.

    script:

    ***************ZVSE

    !#TM1:S1/999/1/1; set TM1 for red

    !?TM1;!!UN:U16/-1/?v100;!!VRv1:S-1;!!IF:M^Found %V100 Creature Banks. Now run through all of them.^;!!DO123/1/v100/1:P;

    !!IF:M^Put Shroud.^;!!UN:H72/72/0/1/100; Close for Red

    !!UN:H72/72/1/1/100; Close for Red

    !!VRv1:S-2;!!IF:M^Now run in backward order.^;!!DO124/1/v100/1:P;

    !?FU123;!!UN:U16/-1/-1/1;!!UN:Sv1/v2/v3/0/3; Open for Red!!UN:Lv1/v2/v3/100; Move a look for 100 ms

  • 8/12/2019 ERM358

    41/57

    !?FU124;!!UN:U16/-1/-2/1;!!UN:Sv1/v2/v3/0/3; Open for Red!!UN:Lv1/v2/v3/100; Move a look for 100 ms***************

    22) Extended UN:V command to see if a player used cheat codes.

    Now you can check also whether the cheat menu is enabled or disabled and check if a player has tried to use cheat codes during the game. !!UN:V?$1/?$2/$?3/?$4/?$5/?$6/?$7; $6 =1 if cheat menu is enabled and =0 if disabled. $7 =1 if the player used cheat codes till now, 0=no. Comments: 1. You may not enable or disable the cheat menu to be SHOWN but you may checkit. 2. In multiplayer, neither cheat codes nor cheat menu works. 3. If you disable cheating, it works for keyboard codes and for cheat menu (even if it is enabled).

    NEW AND EXTENDED VR RECEIVER COMMANDS: M1, M2, M3, M4, M5, M6, U, V, R

    1) New VR Receiver command to get a substring: !!VRz#:M1/z#1/#2/#3;

    Get a substring.!!VRz#:M1/z#1/#2/#3 Get a substring from z#1 and set it to z#. z# - a variable that receives the result; may be standard or local z variable. z#1 - a variable that is a source; may be standard, local or extended z variable. #2 - start position of z#1 string to copy (0 based). #3 - length of substring to copy. Example:

    !!VRz1:S^NTV PLUS for Heroes!^;!!VRz2:M1/z1/4/7;In result we have z2 = "PLUS fo"

    2) New VR Receiver command to get a token: !!VRz#:M2/z#1/#2;

    Get a token.!!VRz#:M2/z#1/#2 Get a specific token #2 from z#1 and set it to z#. z# - a variable that receives the result; may be standard or local z variable. z#1 - a variable that is a source; may be standard, local or extended z variab

    le. #2 - a token number (0 based). Comments: Delimiters are: space, comma, dot, tabulator, new line. Example: For a string:"A string.of ,,tokensand some more tokens" We have the next tokens:0 -> "A"

  • 8/12/2019 ERM358

    42/57

    1 -> "string"2 -> "of"3 -> "tokens"4 -> "and"5 -> "some"6 -> "more"7 -> "tokens"

    3) New VR Receiver command for integer to string conversion: !!VRz#:M3/#1/#2;

    Integer to alpha conversion.!!VRz#:M3/#1/#2;or!!VRz#:M3/#1; Convert a number to a string. z# - a variable that receives the result; may be standard or local z variable. #1 - any number (or any numeric variable) to be converted. #2 - radix; a base of a value (default is 10) Examples: !!VRz1:M3/123; -> z1="123" !!VRz1:M3/123/10; -> z1="123" (the same as above) !!VRz1:M3/-123; -> z1="-123"

    !!VRz1:M3/127/16; -> z1="0x7F" (hexadecimal)

    4) New VR Receiver command to get the length of a string: !!VR#:M4/$;

    Get the length of a string.!!VR#:M4/$; # - z variable $ - any numerical variable (to store the length) Comment: Includes the full length, including leading and trailing spaces.

    5) New VR Receiver command to get the first non-space position in a string: !!VR

    #:M5/$;

    Get the first non-space character position.!!VR#:M5/$; # - z variable $ - any numerical variable (to store the position) Comment: If there are no leading spaces, the position is 0. If the string is empty, the position is -1.

    6) New VR Receiver command to get the last non-space position in a string: !!VR#:M6/$;

    Get the last non-space character position.!!VR#:M6/$; # - z variable $ - any numerical variable (to store the position) Comment: If there are no trailing spaces, the position is the length of the string -1. If the string is empty, the position is 0.

    Example:!!VRz10:S^ Abc def ^; [Assign text to string z10]!!VRz10:M4/y5; [Get length to y5]

  • 8/12/2019 ERM358

    43/57

    !!VRz10:M5/y6; [Get 1st non-space position to y6]!!VRz10:M6/y7; [Get last non-space position to y7]

    M4: y5 returns 12.M5: y6 returns 2.M6: y7 returns 8.

    7) New VR Receiver command to search for a substring within a string: VRz#:U;

    Format can be: !!VRz#1:Uz#2; or !!VRz#1:U^Text^;

    Searches for the substring z#2 or ^Text^ within the z#1 string and sets Flag 1to TRUE if there is such a substring, otherwise to FALSE.

    Z var in both sides may be of any type (standard, local, ERT based). This meanthat this command may be easily ERTified.

    Comments: This uses a case insensitive algorithm, so "Sword" equals "sword" and "SwOrD".It skips leading and trailing spaces (and new line characters), so " Hi ", "hI" and " hi " all means just "HI" (all translated to upper case before searching).

    It does not skip any space or new line characters that are located inside of the text. So "Hi, it's me" and "Hi, it's me" are different. Both strings are processed before search procedure is executed. So the text like this "Hi,%Z5!" will become "Hi,Slava!" (if z5 is set to "Slava") before processing.

    Example. Here you will have both messages "Yes!" and "Yes again!":***********ZVSE!#VRz100:S^ Sword

    ^;!#VRz200:S^

    This_is the_sword text

    ^;!#VRz200:Uz100;!#IF&1:M^Yes!^;!#VRz200:U^

    sWorD^;!#IF&1:M^Yes again!^;**********

    8) New VR Receiver command for convert a string to a value: !!VR$:Vz#;