Code:
Version 3.4.0 (04/2020)
------------------------
[+] Added possibility to use animated defs in DL-dialogs. Just append " animated" to dialog item name to make it animated. Example: "Def" => "Def animated".
Up to 10 animated defs are supported for each dialog. Animation speed is 10 frames per second. One single DEF group of frames is used.
[+] Added possibility to specify frames group index for defs in DL-dialogs. Write frame index as GROUP_INDEX * 100000 + FRAME_INDEX. Group indexes are counted from 0.
[+] Implemented horizontal text alignment support in Era Markup Language (EML).
To specify alignment use either regular color tags with new align=xxx attribute or new tag "text".
Possible alignment values: "left", "center", "right".
Examples:
{~RosyBrown align=right}Some text with(out) images{~}
{~text align=center}Some text with(out) images{~}
{~RosyBrown align="left"}Some text with(out) images{~}
{~text color="RosyBrown" align="left"}Some text with(out) images{~}
Attribute values without spaces and special chars may be written without double quotes.
[+] Implemented block-style images support for Era Markup Language (EML).
Use "block" attribute to mark image in text as block-style. New line before and after image will be forced automatically.
Vertical space in text is also automatically reserved for block images. Moreover, they can be partially scrolled without vanishing effect, occuring for inline images.
Examples:
!!IF:M^{~text align=center}{~Orange}Fire camping{~}
----
{~>CDEVIL.def:0:0 valign="middle" block}
----
{~>cndrgn.def:12:2 block}{~}^;
[+] Added support for 65536-color pcx images (pcx16) in DL-dialogs. Default loading mode is 256 colors (pcx8). To load image as pcx16 change its name in dialogs editor to '****.pcx.pcx16'. Real file name in lod/pac archive should be left as is. The engine will recognise new extension, transform it into '.pcx' and load image as pcx16.
[+] Improved ERM 2 compiler. It became possible to use named local variables and quick variables (f..t) as arrays subscripts.
Syntax: (array[index]) or (array[i]).
Index value is evaluated BEFORE current receiver, thus do not change it in receiver itself like "!!MO998:G?i G(array[i])".
A new magic constant 'SIZE' was added to return array size. Usage: (array[SIZE]). It's compiled into count of array items.
Thus looping through all array items became easy:
!!re i/0/(array[SIZE])/1/-1; Note the last -1, meaning loop from index 0 to SIZE - 1
!!IF:M^%(array[i])^;
!!en;
Note, that regular constants are also supported:
!!IF:M^%(array[PLAYER_TEAL])^;
[+] Implemented automatical static and dynamical index checking for ERM 2.0 arrays. Invalid indexes are reported and forced to valid range.
Example:
!#VA(msgType[7]:y) (msgColor[7]:y);
!!re i/(PLAYER_FIRST)/(PLAYER_LAST);
!!VR(msgType[i]):S(PIC_TYPE_FLAG); Here we get error. Array size is 7, while number of game players is 8. i = 7 is outside of valid 0..6 range
!!VR(msgColor[i]):Si; Here we get error. Array size is 7, while number of game players is 8. i = 7 is outside of valid 0..6 range
!!en;
Let's rewrite the example without bugs:
!#VA(msgType[NUM_PLAYERS]:y) (msgColor[NUM_PLAYERS]:y);
!!re i/(PLAYER_FIRST)/(PLAYER_LAST);
!!VR(msgType[i]):S(PIC_TYPE_FLAG);
!!VR(msgColor[i]):Si;
!!en;
[+] Event DL/(OnCustomDialogEvent) now receive all mouse/keyboard parameters, accessible via !!CM and tracks clicks outside dialogs main area.
Check CM:T or i^dlg_action^ value for:
(DLG_ACTION_INDLG_CLICK)
(DLG_ACTION_OUTDLG_CLICK)
(DLG_ACTION_MOUSE_WHEEL)
(DLG_ACTION_KEY_PRESSED)
Example:
!?DL&i^dlg_action^=(DLG_ACTION_OUTDLG_CLICK);
!!IF:M^You clicked outside dialog!^;
For (DLG_ACTION_MOUSE_WHEEL) action CM:S or i^mouse_action^ can be one of:
(MOUSE_WHEEL_UP)
(MOUSE_WHEEL_DOWN)
Example:
!?DL&i^dlg_action^=(DLG_ACTION_MOUSE_WHEEL);
!!IF:M^Wheel: %i(mouse_action)^; display 1/-1 for wheel up/down
Keyboard presses in dialog can be handled now using Era Erm Framework:
!?DL&i^dlg_action^=(DLG_ACTION_KEY_PRESSED)/i^key^=(KEY_Q);
!!IF:M^Good buy any dialog!^;
!!DLi^dlg_id^:C(TRUE);
Added two global variables to Era Erm Framework:
- i^dlg_action^ with CM:T value (action type). Specially useful for DL-dialog events. See DLG_ACTION_XXX constants.
- i^dlg_id^ with active DL-dialog ID.
[+] !!VR:F command can be called with 3 parameters now: !!VR(var):F(minValue)/(maxValue)/(showErrors);
If the third parameter is specified and not (FALSE), values outside specified range are reported using regular ERM error reporting dialog.
[+] Added new ERM events:
- "OnWinGame" occurs when human player wins scenario.
- "OnLoseGame" occurs when human player loses scenario.
- "OnTransferHero" occurs when hero data from the previous campaign scenario is transferred to the next zone.
The events occurs after instructions but before PI (OnAfterErmInstructions).
The only argument is ID of hero, which is transferred from the previous scenario.
- "OnAfterHeroGainLevel" occurs after AI/Human hero level-up. Dialog is already closed. Use (ERM_FLAG_IS_HUMAN) and (CURRENT_HERO) constants.
The only argument is Hero ID.
[+] Added extra parameter to "OnKeyPressed" event. "OnKeyPressed" occurs multiple times, when you hold the key, while it's sometimes necessary to catch only the first time, when key state changes to DOWN and ignore other events until key state changes to UP. The third event argument serves this purpose and is TRUE only when the key changes its state to DOWN.
!?FU(OnKeyPressed);
!#VA(key:x) (preventDefault:x) (isDown:x);
[+] Implemented two universal events for handling human local events: "OnBeforeLocalEvent" and "OnAfterLocalEvent". They occur before any !?LE/!$LE trigger respecively
and receive 3 parameters: x, y and z coordinates.
Example:
!?FU(OnBeforeLocalEvent);
!#VA(x:x) (y:x) (z:x);
!!IF:M^OnBeforeLocalEvent %(x) %(y) %(z)^;
!?FU(OnAfterLocalEvent);
!#VA(x:x) (y:x) (z:x);
!!IF:M^OnAfterLocalEvent %(x) %(y) %(z)^;
[+] Added the following new functions to Era Erm Framework:
!?FU(IsDllLoaded);
; Returns (TRUE) is specified DLL is loaded. The check is fast and does not lead to loading dll.
!#VA(dllFileNamePtr:x); DLL file name with extension (*.dll, *.era, *.ani, etc).
!#VA(result:x); Boolean. (TRUE) if DLL is loaded.
!?FU(FileExists);
; Returns true if file (not directory) exists.
!#VA(filePathPtr:x); Absolute or relative path to file
!#VA(result:x); Boolean. (TRUE) if file exists and is not a directory
!?FU(DirExists);
; Returns true if a directory (not a file) exists.
!#VA(dirPathPtr:x); Absolute or relative path to directory
!#VA(result:x); Boolean. (TRUE) if directory exists and is not a directory
!?FU(DeleteFile);
; Deletes specified file and returns success flag.
!#VA(filePathPtr:x); Absolute or relative path to directory
!#VA(result:x); Boolean. (TRUE) if file existed and was deleted.
!?FU(ClearIniCache);
; Erases all cached ini file data from memory. You can safely delete ini file afterwards.
!#VA(filePathPtr:x); Absolute or relative path to ini file
!?FU(CreateDir);
; Creates new directory if it does not exist.
!#VA(dirPathPtr:x); Absolute or relative path to directory
[+] The following improvements were introduced in "Era Erm Framework" mod:
- Added new globally saved parameters for "OnKeyPressed" event:
i^key_down^: boolean. TRUE only when the key changes its state from UP to DOWN the first time until being released.
[+] Added the following exported functions to era.dll:
- function IsCampaign: TDwordBool;
!!SN:F^IsCampaign^; v1 = (TRUE) or (FALSE)
- procedure GetCampaignFileName (Buf: pchar);
!!SN:F^GetCampaignFileName^/?(campaignFileName:z); will crash if it's not campaign
- procedure GetMapFileName (Buf: pchar);
!!SN:F^GetMapFileName^/?(mapFileName:z);
- function GetCampaignMapInd: integer;
Returns campaign map zone index (index in original zone maps list, starting from 0).
!!SN:F^GetCampaignMapInd^; will crash if it's not campaign
!!IF:M^%v1^;
[+] Fixed transferring of WoG commanders with heroes in campaigns. Previously transferring didn't work if hero was inactive in transition zone.
"OnTransferHero" is called for all transferred heroes, even for inactive ones, which will be used in other zones.
[+] Added support for 32-bit colors in backgrounds of text items (rewritten Pcx16_FillRect).
[+] Disabled ALT + KEY system menu triggering in windowed mode. ALT key combinations can be freely used by scripts.
[+] Updated ERM editor.
[*] Fixed non-working "OnBeforeBattleReplay" and "OnAfterBattleReplay events". Newest "BattleReplay" plugin by igrik is required.
After battle end when user clicks "Cancel" button, "OnBeforeBattleReplay" is generated. Battle state is reset and "OnBattleReplay" event
is generated, where you can revert global variables to pre-battle state, because OnBeforeBattleUniversal will not be called twice.
[*] Renamed "OnTownHallMouseClick" to more accurate "OnTownFortMouseClick".
[!] SN:Q is deprecated and shoudn't be used for new scripts because it may break any ERM library/mod/script functionality.
ERM interpreter and Era Erm Framework were updated to support SN:Q in old scripts.
If an event has at least single Lua/Erm/plugin handler, whenever it ends or SN:Q is called, an "OriginalEventName_Quit" trigger is called with the same x-arguments.
In quit triggers SN:Q works as FU:E.
Example:
!?FU(OnAfterErmInstructions);
!!FU(ex_OnSomeCustomEvent):P;
!?FU(ex_OnSomeCustomEvent);
!!IF:M^Trigger 1^;
!!SN:Q; skip Trigger 2, trigger "ex_OnSomeCustomEvent_Quit" event
!?FU(ex_OnSomeCustomEvent);
!!IF:M^Trigger 2^;
!?FU(ex_OnSomeCustomEvent_Quit);
!!IF:M^Quit Trigger Handler^;
!!SN:Q; works as FU:E here
!?FU(ex_OnSomeCustomEvent_Quit);
!!IF:M^Another Quit Trigger Handler^;
[-] Fixed bug with random input delay in text input controls.
[-] Fixed bug in Era Erm Framework: NewIntArray and NewStrArray function were ignoring (storageType) argument.
[-] Fixed bug in Era Erm Framework: mouse/keyboard event data was not restored on trigger end.
[-] Fixed invalid spells count for Thunder Lord in zcrtrait.txt. Credits: Archer30.