Functions

rnd(MIN, MAX)
round(NUMBER_TO_ROUND, NUMBER_OF_POSITIONS)
secs
sqrt

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.

sqrt(NUMBER)

Returns the square root of the number specified in NUMBER.

Example:

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