SmartBody : Synchronizing Multiple Character's Behaviors with BML

BML blocks that contain behaviors can only be specified per character. You are allowed to send multiple commands to different characters, such as the following:

bml.execBML('utah', '<head type="NOD"/>')
bml.execBML('harmony', '<head type="NOD"/>')

but since each block contains behaviors for only a single character, each character's BML cannot be explicitly synchronized with each other. However, you can use the <sbm:event> BML tag to trigger an event that will synchronize one character to the other, as in:

harmonyBML = "<head type=\"NOD\"/>"
harmonyName = "harmony"
bml.execBML('utah', '<head id="a" type="NOD"/><event start="a:start+1" message="bml.execBML(harmonyName, harmonyBML)"/>')

which will trigger a BML nod behavior once Utah's nod has been in effect for one second. The syntax of the <sbm:event> tag is as follows:

  • the sbm keyword tells SmartBody to respond to this message.
  • the python keyword tells SmartBody that the rest of the command will be using Python

Note that all <event> BML tags are sent over the VH message bus (the ActiveMQ server), thus the need to use the sbm keyword. In general, any command can be placed in the message="" attribute, as long as the contents comply with XML syntax.