6.4. Action (structured action)

<action> ‐ A sequence of elementary or structured actions

6.4.1. Attributes

NameTypeDefaults
delayFLOAT0.0
immediate_interpretationBOOLEANfalse

6.4.2. Description

The action element is used to embrace a sequence of elementary or structured actions.

The float value of the delay attribute defines the delay after which the action will be executed.

If the boolean value of the immediate_interpretation attribute is true, the parameters of the action are evaluated at posting time and not at execution time. This feature is only useful for delayed actions, actions with a non null delay attribute value.

6.4.3. Expected children

A sequence of structured actions (action, repeatAction, whileAction, or ifAction elements) or a sequence of elementary actions followed by a target.

6.4.4. Example

Several elementary actions on the same target node can be embraced in the same action element:

<action>
  <set_sound_attribute_value operator="=">
    <sound begin="(now+(4*{#startdelay}))" end="10000"/>
  </set_sound_attribute_value>
  <send_message value="color_play" />
  <target type="single_node" value="#sphere 5" />
</action>

An action can be delayed and executed a certain amount of time after the reception of the triggering event. The value of the float attribute delay defines this delay. The following action is executed 0.2 time units after pressing the key "V":

<command>
  <trigger type="keystroke" value="V" />
  <action delay=".20">
    <set_schedule_new_weights index="1" operator="=">
      <weights dim="9"> 0 0 0 0 0 0 0 1 0 </weights>
    </set_schedule_new_weights>
    <set_schedule_new_weights index="2" operator="=">
      <weights dim="9"> 0 0 0 0 0 0 0 0 1 </weights>
    </set_schedule_new_weights>
    <set_schedule_attribute_value index="1" operator="=">
      <schedule begin = "now" />
    </set_schedule_attribute_value>
    <target type="multiple_nodes" value="#interpolator wall1-left" />
  </action>  
</command>

The elementary actions are described in Chapter 7 together with their arguments.