<ParamsToAdd>

<ParamsToAdd> == <ParRep> || <ParamsToAdd> , <ParRep> || <ParamsToAdd> <ParRep>

<ParRep> == <ParSel> || <RepeatCount> * <ParSelOrParAdd> || <RepeatCount> @ <ParSelOrParAdd>

<ParSelOrParAdd> == <ParAdd> || <ParSel>

<ParSel> == <ParChoice> | <ParChoice> || <ParSel> | <ParChoice>

<ParChoice> == <ParAdd> || <Probability> : <ParAdd>

<ParAdd> == [ <ParName> <AddMode> <ParamValue> ] || ( <ParamsToAdd> ) || <MacroName>

<ParName> == <Name>

<AddMode> == = || += || -= || #=

<MacroName> == <Name>

<ParamValue> == … follows the syntax of the Parameter   <ParName>

<Probability> == <Simple>

<RepeatCount> == <Integer>

The   <ParamsToAdd> parameter is a list of other parameters, which will be added to the actual set of parameters. The simplest example (even if it has no advantage in this form):

M=STOP;C=NS_DE2R;AP=[BG=TREE1];

this line is equvalent with the following line:

M=STOP;C=NS_DE2R;BG=TREE1;

Why then this complicated form ? One can select different parameter sets:

M=STOP;C=NS_DE2R;AP=[BG=TREE1]|[FG=TREE2];

either TREE1 stays in the background, or TREE2 stays in the foreground.

This type of parameter can not only set (or replace, if was already set) a parameter, but it can extend it too. Using the += characters the content will be added after the existing part of the parameter, -= means to insert it in the beginning of the existing parameter:

M=STOP;C=NS_DE2R;BG=(M_STATION1:40;);AP=[BG=-TREE1:40-20;];

this line places the tree behind the station building (as the parameter will be inserted before the existing part, the resulting background definition will be   BG=(TREE1:40-20;M_STATION1:40;);

M=STOP;C=NS_DE2R;BG=(M_STATION1:40;);AP=[BG=+TREE1:40-20;];

this line places the tree before the station building (as the parameter will be inserted after the existing part, the resulting background definition will be   BG=(M_STATION1:40;TREE1:40-20;);

(If you manipulate the forground or background definition, it is a good practice always to close the background parts with a semicolon, even the last one. Maybe you will add one more part to the definition sometimes …)

The #= means: the parameter will be set only if it wasn't set before (it gives a default value for the named parameter, but doesn't change it's value, if it is already given).

In which cases is it usefull to define the parameters in this way:

The syntax allows even the repetition for the addition parameters. Of course there is no use for a simple setting,

setting the train speed 3 times is not stronger, as setting it only a single time. But repeating a background/foreground element, which is placed on a random position is usefull.

Look at the following macro definition:

$DEF BGBASE=[BG-=SKY02:..;TRBED5:..,^0;]

$DEF TREE_SUMMER=TREE1|TREE3|TREE3A|TREE3B|TREE3C|TREE3D|TREE4|TREE4A|TREE4B|TREE4C|TREE4D|TREE4E|TREE5A|TREE5G|TREE5H

$DEF TREES_SUMMER=0-10*20,10*(TREE_SUMMER,0-10*20)

$DEF BG_SUMMER=1:0|2:1|3:2|4:3|6:4|4:5|3:6|2:7|1:8*[BG-=TREES_SUMMER:*+0-400;],[BG-=BG_GRAS1:..,-12;],BGBASE

Using the parameter

AP=BG_SUMMER;

in a movement or a segmentation command you will get a variable background - a blue sky, some trees or even a forest, and gras below the trackbed. The last macro repeats 0-8 times the [BG-=TREES_SUMMER:*+0-400;] part of the definition, which itself is a repetition of 10 trees placed direct near each other or to a distance of 20 - 200 pixels.

Another example: freight trains running from left to right should be loaded with coal, in the other direction the wagons should be empty. You can use the parameter:

AP=[D=R]|[D=L][C-=[!E]];

Many loaded wagons has the modifier [E!BT: … ] in the stock list: if the E condition is defined, the load will be removed (replaced by a transparent block). The AP= ; parameter selects the running direction, but together with the running direction it inserts the condition as a global modifier into the train definition - all the wagons will get the E condition, and remove their loads (of course, you should compose the trains only from such wagons having this modifier - or, you can insert it yourself into the stokc list or into the timetable file too).

A similar idea:

AP=|[M#=STOP][BG+=M_STATION1|CSD_STATION1|GUMPENRIEDASBACH:(20-80)+0=STATION;][P#=*STATION];

In the 50% of the cases there will be nothing - the leading  |  means a selection with an empty left part.

If the right part is selected, then