7.12. SendMessage

send_message ‐ An action for sending an internal message at the next frame

7.12.1. Attributes

NameTypeDefaults
valueSTRINGNone (required)

7.12.2. Description

This action is used to send a message to a node of the scene graph. The message emission is delayed to the next frame. The string value of the value attribute defines the label of the message that will be received by the target node(s). If the string contains parenthesized expressions, they are dynamically evaluated as numerical expressions and their values replace the expressions in the string. See also execute_message that sends a message immediately whereas send_message is delayed to the next frame.

Messages can have arguments that will be received by a trigger. For this purpose, they must have an OSC-like syntax: <address> (<parameter>)+. The <address> is an identifier that begins with a '/' character followed by alphanumerical characters and the <parameter>s are chosen among f (float), i (integer), and s (string) (see the description of patterns in the aliasScript element and message_event based triggers).

7.12.3. Expected children

None.

7.12.4. Expected target

Any node in a scene graph can receive a message.

7.12.5. Examples

The example below defines an action that sends a message labeled loop X in which X is the value of the attribute x in the element identified by the ID for_loop.

<send_message value="loop ({$for_loop:x})" />

The example below defines a command that receives a message with one argument and two actions that use the value of this argument ({$1}). The first action stores the value of this argument in a scalar variable. The second action sends a message labeled /faceAnim with three parameters. The first parameter is {$1}, the first value received by the command trigger and the other two values are read from a table at indices {$1} and {$1}+1.

<command>
  <trigger type="message_event" value="/faceInterpolation i" />
  <action delay="({$root:delays[({$1})]}/1000.0)">
    <set_node_scalar_value id="faceIndex" value="({$1})" operator="=" />
    <send_message value="/faceAnim ({$1}) ({$root:indFace[({$1})]}) 
                  ({$root:indFace[({$1}+1)]})" />
    <target type="single_node" value="#root" />
  </action>
</command>