User Tools

Site Tools


variable-en

User Variables

Description

User variables can be used in combination with Actions and Conditions.
See for more information:


This chapter describes the variables that are to be defined by the user.
In addition Rocrail offers even more than 30 "build in" variables whose values are determined by the operating process.
Therefore look here: Text variables


Index



General


ID

The ID is used through out the Rocrail program as a unique key for referencing this variable.

Group

A group can be specified. This is for the sake of clarity, since you can sort by group in the table window.

Description

A description can be given. Only used for information so that you know later what you have created this variable for.

Min/Max

The range used for generating a random number.
Max. must be set greater than Min.

Actions

See Actions for more details.

  • Only the numeric value can be used as action state.
  • Actions are checked after a command has been issued.
  • Timer variable actions are only checked in case it is in active timer mode triggered by start command.


Action commands

Command Description Remark
value Set a new numeric value.
add Add a value to the numeric value.
subtract Subtract a value from the numeric value.
text Set a new text.
random Generate a random number in the range of min./max.
start Starts the timer; The value will be increased at every tick.
The start value must be set in the parameter field.
The timer tick interval is dependent of the Action Timer option.
stop Stops the timer.
min Sets the min. value.
max Sets the max. value.


Action status and conditions

Condition Description Example
=value Compare the variable value with the given value. =1030
>value Check if the variable value is greater than the given value. >4711
<value Check if the variable value is less than the given value. <23
!value Compare the variable value with the given value if they are unequal. !47
#text Compare the variable text with the given text. #nogo
?text Compare the variable text with the given text if they are unequal. ?gogo
text not defined check if a text variable is not defined(empty) string? @var - NULL


Status and Parameter Syntax

Prefix Reference
# Variable ID
$ Text ID
& System variable: time


Operators
+ Add
- Subtract
/ Divide
* Multiply
! Modulo

The operations will be processed from left to right disregarding the mathematical rules.

Values, variables and operators must be separated by one blank.

Example:

#Var1 + 67 - $Txt2
#Var1%lcid% + 67 - $Txt2

Text values are converted to an integer and will default to zero if it contains text only.


Action Sub-ID

The Command and Condition Sub-ID is optional and can be used for the following Text Variables:

Loco
%lcid% Loco ID
%bkid% Block ID

This has only affect in automatic mode.
The variable will be automatically created if it does not already exist.


Automatic generated variables

If a train/locomotive does not find a new destination the following variables are automatically generated:

  • lc4112 → LocoID
  • bk4112 → Current block of the locomotive
variable-en.txt · Last modified: 2021/09/02 07:13 by rjversluis