Introduction
Receivers are ERM codes that affect heroes, objects, events, timers, functions,
messages or game settings. Most receivers have multiple commands that can be
used with them for doing different things. For example, the LE receiver affects
local events on a map and there are different commands for changing the
properties of the event.
How to Use Receivers
Receivers are placed in timed events on lines following after a trigger that
serves as a header. They are executed one at a time until the end of the timed
event or a new trigger is reached. More than one receiver may be placed on a
line but for clarity and ease of debugging your script, it's usually best to
keep it to one per line.
Receiver Syntax
All receivers begin with a double exclamation mark (!!) and end with a semicolon
(;). Immediately following the !! is a two-letter receiver code, such as AR for
artifact, HE for hero, LE for local event or OB for object. The next part after
this code depends on the type of receiver. Some receivers have one or more
parameters before the colon (:), each parameter being an integer number, while
other receivers have no parameters before the colon. Following the colon are the
receiver's commands. Commands take many forms and may include one or more
parameters each; they are represented in the list below as XXXX. Replace XXXX
with the appropriate command or commands. After the last command, a semicolon (;)
must be used to mark the end of the
receiver code.
All ERM commands (receivers, instructions) have
to use at least one parameter in order to work correctly.
If a command parameter is shown as $ it means that its value can be stored in
a variable. If it's shown as # it means that it can only be set, but not read.
And if it's shown as ?$ it means it can be read but not set.
Example of receiver syntax:
!!LE12/21/0:E1000;
In the above example, a local event on the map at x=12,
y=21 and level=0 (surface) is being modified so that it now gives 1000
experience to a hero.
Relative Syntax
Often you don't want to replace a value but simply add or subtract from that
value. For example, if you give a hero experience, you want to add to that
hero's current experience rather than replacing it completely with a new, set
value. Likewise for a player's gold or other resources. To accomplish this, we
use a relative syntax: the lowercase d as a prefix to the number.
Example of relative syntax:
!!HE-1:Ed500;
In the above example, 500 experience points are added to the current hero's
present experience total. If we had used E500 rather than Ed500, the hero's
experience would be set to 500 rather than increased by 500. To subtract 500
experience, use Ed-500 instead. If you wish to leave a parameter unchanged, use
d0 or simply d on its own.
Current Date Syntax
In a similar fashion to using the prefix d, we can use the prefix c (again,
always lowercase) to indicate that the
value of the current day will be added to the number. In other
words, c is equal to the current day (e.g., c=4 if it's month 1, week 1, day 4,
c=8 if it's month 1, week 2, day 1, and c=30 if it's month 2, week 1, day 2).
Example:
If an event is set to occur on the
5th, we can change it so that the event occurs on a new day by using the global
receiver (GE, option F$). If we have numbered the event as 100 (first text
in the global event message), we could use !!GE100:Fc6; to make the event
occur 6 days after the day the receiver takes effect (it could be set to be
triggered by a local event trigger). Or, if we wish to simply increase the
existing day by 6 days, we can combine relative syntax d with current date
syntax c. If the current day is the 14th, then Fc6 evaluates to
14+6=20, Fcd6 or Fdc6 evaluates to 14+5+6=25. Thus, we have the following
combinations: d#, c#, cd#, and dc#.
Empty Parameters
If a command has four parameters, you must fill in all four, each
separated by a slash. You cannot omit any parameters or the command won't work,
and you'll probably get an error too. However, in some cases you can omit the
actual numbers and just put in the slashes. When you omit a number in this
fashion it is treated as if you entered zero, and as long as zero is a valid
number for that parameter, the command will work.
Example of empty parameters:
!!IF:D1/5//4////////////;
The command in the above example is used to set up an extended dialog box. It
has more parameters than any other command in ERM, but you won't always need to
use them all. We've only used three out of the possible 16 here. For this
particular command, leaving an empty parameter or entering 0 means "do not
change" but for many other commands it simply means "assume the value
0" which won't always be appropriate.
Multiple Commands
In most cases, you can place multiple commands after a single receiver header
(the part before the colon). Commands do not have to be separated by spaces, but
for readability this is often a good idea. In some instances, such as setting
and manipulating variables with the VR receiver, multiple commands don't always
work correctly. So if you do use multiple commands, make sure you check that
they're all executing properly and giving you the correct or desired result. If
one of your commands is to display or set message text using the carets (^) to delineate
the text, you must place this command last. If you put any other commands after
it (as part of the same receiver), you'll get an error.
Example of multiple commands:
!!LE10/12/0:E1000 M^You learned a lot walking through
the ancient forest of lore.^;
Adding Comments to Your Code
Anything appearing in a script that comes after a semicolon and before the next
receiver or trigger is considered a comment and is ignored by the ERM processor.
Some people like to put their comments inside square or angle brackets to make
it easier for another person reading the script to tell the difference between
comments and ERM code, but this isn't strictly necessary.
Example of code with comments (after the semicolon):
ZVSE
!?LE10/23/1; Event at x=10, y=23, level=underground
!!HE-1:B0/?z5; Store hero's name in variable z5.
!!IF:M^A disembodied voice calls out "%Z5...%Z5...you are our last
hope..."^;
[The above message displays using the hero's name to make it more personal.]
Using Variables in Receivers
Variables may be used in receivers to replace any # or $ with the exception
of the # used for the CE and GE receivers prior to the colon. All other
occurrences of # or $ in a receiver, both before and after the colon may be
replaced by a variable of an appropriate type. Most of the receivers that
reference a map location may also be used with an indirect variable reference.
In this form, the index number of the v variable holding the x location is
entered. The y location and level location must be stored in the following two v
variables. For example, if you store the location of x in v10, y must be in v11
and level in v12. See the Flags and Variables page
for more details on variables.
Example of OB receiver using indirect reference:
!!VRv10:S24; [Store x location]
!!VRv11:S14; [Store y location]
!!VRv12:S0; [Store map level]
!!OB10:S; [Disable object at v10/v11/v12]
Instructions
Instructions are identical to receivers except that they begin with an
exclamation mark/pound sign combination (!#) and activate only once, when
the map is first loaded. Most receivers work fine when used as instructions, but
some (especially certain object receivers), will not work at all and will cause
an error or map crash. Instructions are executed one at a time, at map load, in
the order that they appear in timed events, regardless of whether or not there
are triggers, receivers or comments before or after them. You can use an
instruction to call a function trigger and all the regular (non-instruction)
receivers that are part of that function will then execute normally, however,
you must include the function in the timed event before the
instruction that calls it, or it won't work; you won't get an error, it just
won't execute the function.
Example of instruction:
!#VRv10:S25; [store 25 in the variable
v10]
Syntax |
Receivers |
!!AI:XXXX; | Set destination points for AI
heroes to move to. For more details, see the AI Receiver page. |
!!AR#1/#2/#3:XXXX; |
Artifact or resource at the specified position on the map.
#1 = x, #2 = y, #3 = level (0-surface, 1-underground) For more details, see the AR Receiver page. |
|
Used to set up the characteristics of a battle. |
!!BF:XXXX; | Sets up a battlefield with
custom placement of obstacles. For more details, see the BF Receiver page. |
!!BG: |
During combat, you may
check/set/get parameters on taken action that's being taken. For more details, see the BG Receiver page. |
!!BH#: |
During combat, you may check/set/get some parameters of a hero at # side (0=left, 1=right). For more details, see the BH Receiver page. |
!!BM#:XXXX; |
Check/Set/Get some parameters of a stack of monsters # - number of a stack (0...41). Usually it is used like 0...20 for a first (0) player and 21...41 for a second (1) player. For more details, see the BM Receiver page. |
!!BU: |
During combat, you can
check/set/get some universal parameters of the battle For more details, see the BU Receiver page. |
!!CA#1/#2/#3:XXXX; |
Town setting for town at the specified position on
the map. #1 = x, #2 = y, #3 = level (0-surface, 1-underground) For more details, see the CA Receiver page. |
!!CA#:XXXX; |
As above but coordinates are in variables
v[#],v[#+1],v[#+2] For more details, see the CA Receiver page. |
!!CA-1:XXXX; |
The current town. Be careful for you can use it only in Town screen. |
!!CD:XXXX; |
Used to set up the parameters for town demolitions initiated by a player. For more details, see the CD Receiver page. |
!!CI:XXXX; |
Used to modify income and monster growth of Castle. For more details, see the CI Receiver page. |
!!CE#:XXXX; |
Event in a town (# = number of event). This is the number, which
should be first in the text of the appropriate event. It won't appear
in the text of the message. For more details, see the CE Receiver page. |
!!CM:XXXX; |
Get/check/set info about mouse click.
For more details, see the CM Receiver page. |
!!CO#:XXXX; !#CO#:XXXX; |
Commander attributes #=-2 - Apply to all Commanders #=-1 - Apply to current Commander (for current hero) #>=0 - Apply to specific Commander For more details, see the CO Receiver page. |
!!CR#:XXXX; !!CR:XXXX; |
Commands that modify attributes of Curses and Blessings. For more details, see the CR Receiver page. |
!!DG:XXXX; |
Commands regarding digging for Grail. For more details, see the DG Receiver page. |
!!DL:XXXX; |
Custom dialog support. For more details, see the DL Receiver page. |
!!DO#1/#2/#3/#4:P; |
Call a function trigger multiple times: #1 number of a function #2 start value #3 stop value #4 increment For more details, see the DO Receiver page. |
!!EA$:XXXX;![]() |
Receiver for adding stack experience support to ERM $ is a type of monster For more details, see the EA Receiver page. |
!!EX$1/$2:XXXX;![]() |
Receiver for creature stack experience $1 is Hero's ID(-1, 0..MaxIndex), $2is slot index (0..6) For more details, see the EX Receiver page. |
!!FC:XXXX; |
Flag color receiver. Now any object can have a flag. For more details, see the FC Receiver page. |
!!FU#:XXXX; |
Function receiver - transfers control to ERM code following
function trigger. For more details, see the FU Receiver page. |
!!GE#:XXXX; |
Receiver is a global (timed) event (# - number of event). For more details, see the GE Receiver page. |
!!HE#:XXXX; |
Receiver is a hero with hero number of # (see
Format
H). For more details, see the HE Receiver page. |
!!HD:XXXX; |
Hint Display receiver. More convenient than checking rightclick every time. For more details, see the HD Receiver page. |
!!HE#1/#2/#3:XXXX; |
The hero at the specified position on the map. #1 = x, #2 = y, #3 = level (0-surface, 1-underground) For more details, see the HE Receiver page. |
!!HE-1:XXXX; |
The hero who activated the trigger. Comments: Using this format makes ERM coding a lot simpler because you won't need to keep changing the coordinates for every !!HE command if you move the trigger event or object. For more details, see the HE Receiver page. |
!!HL:XXXX; |
Set primary and secondary skills that a hero can
choose from when gaining a level. This receiver can only be used after an !?HL;
trigger. For more details, see the HL Receiver page. |
!!HO#:XXXX; |
# means a number of hero.
This is not the same as the HE receiver. It is used for enabling/disabling
interaction with a given hero and for setting adventure map hint text for a
hero. For more details, see the HO Receiver page. |
!!HT#1/#2:XXXX; |
Lets you set the hint (right-click) text of all
adventure map objects of a specific type (#1) and subtype (#2). To set a hint
for all subtypes, use a value of -1 for #2. For more details, see the HT Receiver page. |
!!if:; !!el:; !!en:; |
If-else-endif statement. For more details, see the I\E Receiver page. |
!!IF:XXXX; |
Management of conditional flags, player questions (GRM), plus message and
picture display. For more details, see the IF Receiver page. |
!!IP:XXXX;
![]() |
Network game support
For more details, see the IP Receiver page. |
!!la#:; !!go#:; |
Go-to statement. For more details, see the GoTo statement page. |
!!LD:XXXX; |
Manage custom LOD files. For more details, see the LD Receiver page. |
Event at the specified position on the map. For more details, see the LE Receiver page. |
|
!!LE# |
As above but coordinates are in variables
v[#],v[#+1],v[#+2] For more details, see the LE Receiver page. |
!!MA:XXXX; |
Globally changes the
characteristics of a monster type for all monsters on the map of that type. For more details, see the MA Receiver page. |
!!MC@:XXXX; |
Set up macros. Use to assign a
text name to a variable. Applicable to variables f..t, v# or w#. For more details, see the MC Receiver page. |
!!MF:XXXX;![]() |
Receiver for creature stack taking physical damage For more details, see the MF Receiver page. |
!!MM:XXXX;![]() |
Battle log receiver
For more details, see the MM Receiver page. |
The monsters at the specified position on the map. #1 = x, #2 = y, #3 = level (0-surface, 1-underground) For more details, see the MO Receiver page. |
|
As above but coordinates are in variables
v[#],v[#+1],v[#+2]
For more details, see the MO Receiver page. |
|
!!MP![]() |
Used to change in-game predefined music For more details, see the MP Receiver page. |
!!MR:XXXX;![]() |
Receiver for creature stack magic resistance For more details, see the MR Receiver page. |
!!MW#:XXXX; |
Wandering Monsters # is a number of Wandering Monster For more details, see the MW Receiver page. |
!!OB#1/#2/#3:XXXX; |
Object at the specified position on the map. #1 = x, #2 = y, #3 = level (0-surface, 1-underground) For more details, see the OB Receiver page. |
As above but coordinates are in variables
v[#],v[#+1],v[#+2]
For more details, see the OB Receiver page. |
|
Other Object Receivers |
Many map objects also have specific receivers for changing their settings. For more details, see the Other Objects page. |
!!OW:XXXX; |
These are commands that apply to a specific
player. |
!!PM#:XXXX; |
Pyramid receiver. For more details, see the PM Receiver page. |
|
Used to set up or check information on any square of
the map. #1 = x, #2 = y, #3 = level
(0-surface, 1-underground) For more details, see the PO Receiver page. |
|
As above but coordinates are in variables
v[#],v[#+1],v[#+2] For more details, see the PO Receiver page. |
!!QW:XXXX; |
Lets you add, remove or change an entry in the new
Papyrus quest log. For more details, see the QW Receiver page. |
!!SN![]() |
Used to change in-game
sound effects For more details, see the SN Receiver page. |
!!SS#:XXXX; |
Spell support. For more details, see the SS Receiver page. |
!!TM#:XXXX; |
This is for setting up the ERM timer. # = timer number (1-100). For more details, see the TM Receiver page. |
!!TL:XXXX; |
Turn time limit receiver. For more details, see the TL Receiver page. |
!!TR#1/#2/#3:XXXX; |
Set terrain type or change passability of a
square at the specified position on the map. #1 = x, #2 = y, #3 = level (0-surface, 1-underground) For more details, see the TR Receiver page. |
!!TR#:XXXX; |
As above but coordinates are in variables
v[#],v[#+1],v[#+2] For more details, see the TR Receiver page. |
!!UN:XXXX; |
Universal commands. These commands relate to changes on the heroes map. For more details, see the UN Receiver page. |
!!UX:XXXX; |
Universal extended. For more details, see the UX Receiver page. |
!!VA#:XXXX; |
Value Slots For more details, see the VA Receiver page. |
!#VC:XXXX; | Control of ERM
Variable usage: used to log flags, variables, timers, functions and loops For more details, see the VC Receiver page. |
!!VR@:XXXX; |
Management of variables: setting, comparing and doing math
with them. @ is a variable name: f...t, v1-v1000, etc. For more details, see the VR Receiver page. |