Description

Events can be triggered based on various synchronization points of a BML command. These events can be handled by SmartBody's event handlers, or they can be explicit commands to perform some action or change character state. One way to use such events is to coordinate multiple characters with a single BML command, since BML typically only contains instructions for a single character.  For example, a BML command directing a character to talk could include an event that is triggered when that utterance is finished for a different character to nod their head in agreement.

Requirements

None

Usage

<event start="3" message="print 'hello'/>

 

 

This will send out an event 3 seconds in the future which prints the word 'hello'.

<event start="2">
<![CDATA[
n = scene.getNumCharacters()
names = scene.getCharacterNames()
for i in range(0, n):
   print names[i]
]]>
</event>
 

This will send out an event at time 2 to print out the names of the characters in the same. Note that a multi-line command can be used by using the CDATA XML directive which tells the XML parser to interpret the contents as free text.

 
<speech id="sp1">
<mark name="T0"/>hello
<mark name="T1"/>
<mark name="T2"/>how
<mark name="T3"/>
<mark name="T4"/>are
<mark name="T5"/> 
<mark name="T6"/>you?
<mark name="T7"/>
</speech>
<event start="sp1:T4" message="print 'hello'/>

 

This will send out an event before the word 'are' is spoken.

Parameters

ParameterDescriptionExample
startWhen the event will occur. Can be an absolute local time associated with BML block, or a relative time based on synchronization points of other BML behaviors.
<event start="3" message="print 'hello'/>
message

event to be sent. There is no limit to the complexity of the message, but it must adhere to XML syntax.

In lieu of using the message attribute, the CDATA directive can be used to create a multi-line command as shown in the example above.

<event start="3" message="print 'hello'/>