In this part of the article I will continue the description of the script language ViaLatM. The functions that allow access to the attributes of other objects, the conditional assignment function, and others will be considered. The first part of the description in the publication
ViaLatM GPS service is a scripting language , an updated description of the language is available on the website in the
ViaLatM scripting language section.

Setting variables and defining a scenario of work are done in the “Setting Variables and Script” panel in the context menu for each device.
')
Operators are separated by ";".
Comments
If the line starts with the character "#", then it is not processed (comment). If the "#" character is found inside a string, then the content from this character to the end of the line is ignored.
Examples:
- # Processing unit mileage tracker
- Distance: DIST = DISTANCE (L, UNIT.L); # mileage the message
Constants
If a value is used in several operators, it is reasonable to separate it separately and define it as a constant. As a rule, constants are defined at the beginning of the script. The constant identifier is preceded by the keyword "CONST".
Examples:
- CONST RATE_PER_100KM = 8.5;
- CONST MAX_DELAY = 3600;
Local variables
Local variables are only available during script execution after their definition. Unlike global variables, they cannot be displayed in the application interface and are not stored in the permanent attributes of objects. A local variable has no name, that is, the prefix "Name:".
Examples:
- DIST = DISTANCE (L, UNIT.L); # local variable
- Mileage: ODOM = VARDEF (UNIT.ODOM, 0) + DIST;
- Average speed: DIST / (DT-UNIT.DT); # m / s
The function to return the value of the condition
Syntax: IFSET (condit, value1, value2);
The function checks the condition specified in the first argument. If it is true, it returns the value given by the second argument. Otherwise, the value of the third argument is returned. The format of the first argument: val1 relational val2. Where one of the relations can act as a relational: "==", "<=", "> =", "! =", "<", ">".
Examples:
- MaxSpeed: MAX_SPEED = IFSET (V> = UNIT (OWNER, "5678"). V, V, UNIT (OWNER, "5678"). V);
- Load at height: ALT_FACTOR = IFSET (H <500,2.3,5.7);
Access to attribute parameters of other trackers
The UNIT function is used to select attributes of another tracker. As a parameter, the IMEI tracker is passed to it: UNIT ("01234567890"). Attr. After the closing parenthesis, the dot indicates the name of the attribute to be selected (this attribute-parameter must exist on this tracker). The selected tracker must be in the same group (folders serve as groups in the service) as the tracker for which the script is executed. Otherwise, the function returns “ERROR”. Using the additional parameter "OWNER" you can access trackers that are located in another group, but they must be created by the user who owns the current tracker: UNIT (OWNER, "01234567890"). H.
Examples:
- # Information about the control object
- The speed of the control object: ROOT_SPEED = UNIT ("V357504054043955"). V;
- Distance to the control object: ROOT_DIST = DISTANCE (L, UNIT ("V357504054043955"). L);
- # Customer Information
- Distance to customer: CUSTOM_DIST = DISTANCE (L, UNIT (OWNER, "V12345123451234"). L);
In the following parts of the article, language operators will be considered: FOR (OBJ IN SET) - iteration of objects in a given set; IF ... THEN ... ELSE; SWITCH; CALL - procedure call.