Functions

isnumeric(VALUE_TO_TEST)
rnd(MIN, MAX)
round(NUMBER_TO_ROUND, NUMBER_OF_POSITIONS)
secs()
sqrt(NUMBER)

isnumeric(VALUE_TO_TEST)

Returns TRUE if the value passed as VALUE_TO_TEST is numeric, returns FALSE if it is not.

Example:

<assign name="X" expr="'A'"/>
after: isnumeric(x)=FALSE

rnd(MIN, MAX)

Returns a random number between the numbers passed as MIN and MAX.

Use this function to create a random number that can be evaluated in a conditional statement in order to provide greater variety and unpredictability in the interaction.

Example:

<node name="node_1">
<medias>
<if cond="rnd('1','100')&lt;'34'">
<media>
<file>video_1.mp4</file>
</media>
<elseif cond="rnd('1','100')&lt;'51'"/>
<media>
<file>video_2.mp4</file>
</media>
<else/>
<media>
<file>video_3.mp4</file>
</media>
</if>
</medias>
<media_end_node>node_2</media_end_node>
</node>

Note that a variable may be used as a parameter in the rnd(min, max) function:

<assign name="my_variable" expr="'10'"/>
<assign name="random_number" expr="rnd('1', my_variable)"/>

round(NUMBER_TO_ROUND, NUMBER_OF_POSITIONS)

Returns NUMBER_TO_ROUND rounded to the number of decimal positions specified in NUMBER_OF_POSITIONS.

Example:

<assign name="rounded_result" expr="round(’10.123’,’2’)"/>
after: rounded_result=10.12

secs()

Returns the number of seconds (as an integer) that have elapsed since the application started.

Optionally, a value may be passed in the function to set the desired number of decimal places in the return value.

Examples:

If the application has been running for 2.15 seconds:

secs() = 2
secs('1') = 2.1
secs('2') = 2.15

sqrt(NUMBER)

Returns the square root of the number specified in NUMBER.

Example:

<assign name="sqrt_result" expr="sqrt(’9’)"/>
after: sqrt_result=3