Behavior

The heart of MB is the Behavior Table. Click the Behavior... menu item to see the Behaviors window with the Table.

Part of standard behavior table.

The Behavior Table consists of three columns: Active, Event and Action. Double-click on any of the columns to edit it.

You can change the position of a row by clicking and dragging on the leftmost, unlabeled column. You can also press Ctrl-Up or Ctrl-Down to move the selected row up or down, respectively. The number of the currently selected row appears in the small box at the lower right corner of the window.

Active column

The Active column merely toggles the row on and off. When Active is "Off" then the behavior described on that row is inactive. (Note in the table pictured above, the selected row is turned off.)

Event column

The Event column specifies an Event that MB will respond to. When you double-click on the Event column, the Event edit box appears:

An Event entry consists of the Event name (like HEAR or AVATARADD, etc.) optionally followed by a conditional expression. The conditional expression describes additional conditions that you want for that behavior. If the conditional expression evaluates to 0 (false), then the Action on that row won't happen. If the conditional expression evaluates to anything but 0, it will be true and the Action specified on that row of the table will be carried out.

An example of a conditional expression (e.g. to use with a HEAR event) might be @whispered, which is true if the incoming chat string was whispered:

HEAR @whispered
A slightly more complicated example is:
HEAR @eq[$word[1],$botname]
The expression in the above case would evalutate to true if the first word of the incoming chat string is the bot's name.

If no conditional expression is given, then the specified Event will always trigger the Action on that row of the table.

When an Event is edited, you can click on the Insert Event or Insert Condition buttons to choose from a list Events and typical conditions that can be inserted into the edit box at the cursor position. You can also insert logical And or Or symbols (|| or &&).

This popup appears when you click Insert Event:

This popup appears when you click Insert Condition:

You can also click on Insert Function or Insert Attribute to add a MB function template or an AW SDK attribute name, respectively.
This popup appears when you click Insert Function:

This popup appears when you click Insert Attribute:

See Expressions, for more information.

NOTE: When an Event occurs, MB will check each row of the Behavior Table in order, and it's entirely possible for multiple rows (Actions) to be triggered. If you wish MB to stop checking subsequent rows once a particular Action is triggered, then use the ENDCHECK Action, or use the @reacted variable in following rows to tell if a previous row triggered an Action.

See Events for more information.

Action column

Finally, the Actions column describes the Action that will be taken when the Event occurs and it's conditional expression is true.

An example of an Action (e.g., in response to an AVATARADD Event) might be:

say "Hello, "+$avname
...which would cause MB to speak "Hello" and the avatar's name.

When an Action is edited, you can click the Insert Action button to choose from a list of Actions that can be inserted into the edit box at the cursor position. Actions in the list are arranged by category. When the Action string is inserted, a template of arguments for that Action is also inserted; just replace the prototype arguments with yourown by editing the text directly.

This popup appears when you click Insert Action:

You can also click on Insert Function or Insert Attribute to add a MB function template or an AW SDK attribute name, respectively.

The examples above are only very simple ones; MB is capable of much more complex behavior. See Actions for more information.