Events

MB will detect the following events, that can be used in the Behavior Table.



AW Events - See the AW SDK for more details about these events, and which AW Attributes they set. In MB, you can use the @atr and $atrfunctions to find the values of AW Attributes.

HEAR
A spoken, whispered or broadcast message is received. You can check @said, @whispered or @broadcast to determine the nature of the message. The message is contained in the variable $chat. See string functions for many more tests that can be performed on $chat.

ANNOUNCEMENT
A console message is received. The message will be contained in $atr[CONSOLE_MESSAGE].

BOTGRAM
A bot telegram received. The message will be contained in $atr[BOTGRAM_TEXT] and the sender name and session in @atr[BOTGRAM_FROM] and $atr[BOTGRAM_FROM_NAME].

AVATARADD
An avatar arrives in the area. The variable $avname will contain the avatar's name.

AVATARDELETE
An avatar leaves the area. The variable $avname will contain the avatar's name.

AVATARCLICK
Someone clicks on an avatar.  The variable $avname will contain the avatar's name.
(Note: $avname will be an empty string if the bot itself is clicked on.)

AVATARCHANGE
An avatar changes location, gesture or avatar type. The variable $avname will contain the avatar's name.

OBJECTADD
An object is created. The variable @objnum will contain the object's number. Important note: in versions of Magsbot prior to 3.0 (using SDK build 22), the OBJECTADD and OBJECTDELETE events will only be received if the bot has done a survey of the area first. In Magsbot 3.0+ (using SDK build 24), the bot will detect OBJECTADD and OBJECTDELETE if the bot instance is "global mode" or if the bot has done a local survey. (A world survey won't enable detection of OBJECTADD/DELETE, at least in my tests.)

OBJECTDELETE
An object is destroyed. The variable @objnum will contain the object's number. See comment in OBJECTADD, above.

OBJECTCLICK
Someone left-clicks on an object.

OBJECTSELECT
Someone right-clicks on an object.

OBJECTBUMP
Someone bumps an object. This is an AW 4.1 (Magsbot 7.x) feature. Note that you must have both "send bump event" (WORLD_ENABLE_BUMP_EVENTS ) and "enable global events" (WORLD_ENABLE_SYNC_EVENTS) turned on in your world for this to work. Furthermore, the object needs an "bump..." action on it, and "global", like "bump rotate 1 global".  However you can make the action do something insignificant like "bump name global". (In this case there is no name given for the "name" tag, but it doesn't seem to matter as far as causing an OBJECTBUMP event to be sent.

OBJECTRESULT
This message is received after an object change, creation or deletion performed by the bot concludes, whether successful or not.  (This is actually an AW Callback, not an AW Event; but in Magsbot it acts like an event.) The value of @sdkerror indicates if the action was successful (0 if successful, or an error code otherwise).  Although the AW SDK doesn't provide any object information in the context of this event other than the object number, in Magsbot version 5.3 b25 and higher, the other object attributes are provided as well. These are OBJECT_Z, OBJECT_X, OBJECT_Y, OBJECT_YAW, OBJECT_ROLL, OBJECT_TILT, OBJECT_MODEL, OBJECT_DESCRIPTION, OBJECT_ACTION, OBJECT_OWNER and OBJECT_TIMESTAMP.  This allows you to use the OBJECTRESULT event in the behavior table to log the results of building.

SETTERRAIN
This message is received from the world server after an terrain data change concludes, whether successful or not.  (This is actually an AW Callback, not an AW Event.)

DELETEALLTERRAIN
This message is received from the world server after a DELETEALLTERRAIN command concludes, whether successful or not.  (This is actually an AW Callback, not an AW Event.)

QUERY
This message is received after one set of survey information is received. (This is actually an AW Callback, not an AW Event) NOTE: when doing a survey with MBot, the survey automatically continues until all the objects in the area have been polled, so there is no need to use QUERY as a signal to request more survey info. The QUERY event is included in MB only to allow you to monitor the ongoing survey process, if there is some reason that you wish to do so.

CELLBEGIN
Indicates the beginning of a cell update during a survey.

CELLEND
Indicates the end of a cell update during a survey.

CELLRESULT
Result of @cellnext function.  (This is actually an AW SDK Callback.)

CELLOBJECT
Information for a single object is received during a survey.  In AW version 4 (Magsbot version 7), the @atr[OBJECT_DATA] is a pointer to a structure containing object properties, if the @atr[object_type] is one of the new special types: 2=zone object, 3=particle emitter, 4=mover or 5=camera. The data can be accessed in Magsbot using the @byte function, along with the @objdatalen function that tells the size of the data. However it is mich simpler to use the $objdatastr function, that returns a hexidecimal string representation of the data. The string can be converted into a vlist of variables containing object properties using the @vlistfromobjdata function.

TERRAINBEGIN
Indicates the beginning of a terrain query.

TERRAINDATA
Information for a terrain page is received during a terrain query. You can access the data from the Behavior Table using the @heights and @textures functions and the @atr[TERRAIN_NODE_HEIGHTS] and @atr[TERRAIN_NODE_TEXTURES] attributes. For example:  @h1=@heights[@atr[TERRAIN_NODE_HEIGHTS],1] gets the first value from the array of height values.

TERRAINCHANGED
Indicates that the terrain has been changed.

TERRAINEND
Indicates the end of a page update during a terrain query.

SETTERRAIN
Result of a SETTERRAIN command. (This is actually an AW SDK Callback.)

DELETEALLTERRAIN
Result of a DELETEALLTERRAIN command.  (This is actually an AW SDK Callback.)

DELETEALLOBJ
Result of DELETEALLOBJECTS. (This is actually an AW SDK Callback.)

RELOADREGISTRY
Result of RELOADREGISTRY. (This is actually an AW SDK Callback.)

RESETATTRIBSRESULT
Result of RESETWORLDATTRIBS. (This is actually an AW SDK Callback.)

DISCONNECT
The bot is disconnected from the world. (Note: this seems to occur from time to time as a transient event without actually cutting the bot off from the world.)

UNIVDISCONNECT
The bot is disconnected from the universe.

LOGIN
The bot logs in to the universe.  @sdkerror will be 0 if the login was successful, otherwise it will be an error code. You can use $sdkerror[@sdkerror] to get the message associated with the error code.

ENTER
The bot enters a world.  @sdkerror will be 0 if the bot entered the world successfully, otherwise it will be an error code. You can use $sdkerror[@sdkerror] to get the message associated with the error code.

URL
The bot receives a SENDURL from another bot.

URLCLICK
The bot receives an URLCLICK from another bot, or a user clicked on a special web link.

TOOLBARCLICK
The bot receives a CLICKTOOLBAR from another bot, or a user clicked on a toolbar button.

TELEPORT
The bot receives an instruction to warp or teleport somewhere. Use @atr and $atr functions to determine the location and other pertinent information, as shown on SDK page .

EJECTINFO
Ejection list info is returned after a EJECTLOOKUP, EJECTNEXT or EJECTPREV command.

EJECTRESULT
The result of an EJECTADD or EJECTDELETE command is received.

WORLDINFO
Information for a single world is received during a world list query, contained in $atr[WORLD_NAME], @atr[WORLD_USERS] and @atr[WORLD_STATUS].

ADMINWORLDINFO
Information for a single world is received during an ADMINWORLDLIST query by an admin instance.

ADMINWORLDDELETE
Signals an admin instance that a world was deleted from the server.

ADMINWORLDRESULT
Signals the result of several different admin instance commands, such as ADMINWORLDADD, ADMINWORLDDELETE, etc.

USERINFO
Information for a single user is received during a user list query, contained in $atr[USERLIST_NAME], @atr[USERLIST_CITIZEN], etc.

WORLDATTRIBS
World settings (such as lighting, ground, backdrop, etc.) have changed.

UNIVATTRIBS
Universe settings have changed.

New for AW 4.1
SDK documentation for these events is sparse...

ENTITYADD
An entity (mover) enters the bot's area.

ENTITYCHANGE
An entity (mover) in the bot's area changes its location, properties, etc.

ENTITYDELETE
An entity (mover) leaves the bot's area.

ENTITYRIDERADD
A rider gets on a mover.

ENTITYRIDERCHANGE
A rider on a mover changes its properties.

ENTITYRIDERDELETE
A rider gets off of a mover.

New in Magsbot 7.5

BOTMENU
A bot menu item was clicked on. The session of the person clicking will be found in @atr[BOTMENU_FROM_SESSION] and the item number that the user clicked (in the form of a string) will be found in $atr[BOTMENU_QUESTION].  The attribute $atr[BOTMENU_ANSWER] is also available, but I can't find any documentation regarding what this is for!

HUDCLICK
A HUD (heads-up display) was clicked.

HUDCREATE
A HUD (heads-up display) was created.

HUDDESTROY
A HUD (heads-up display) was destroyed.

HUDCLEAR
A HUD (heads-up display) was cleared

Attributes in HUD events:

HUD_ELEMENT_TYPE
HUD_ELEMENT_ID
HUD_ELEMENT_SESSION
HUD_ELEMENT_ORIGIN
HUD_ELEMENT_X
HUD_ELEMENT_Y
HUD_ELEMENT_Z
HUD_ELEMENT_FLAGS
HUD_ELEMENT_TEXT
HUD_ELEMENT_COLOR
HUD_ELEMENT_OPACITY
HUD_ELEMENT_SIZE_X
HUD_ELEMENT_SIZE_Y
HUD_ELEMENT_SIZE_Z
HUD_ELEMENT_CLICK_X
HUD_ELEMENT_CLICK_Y
HUD_ELEMENT_CLICK_Z
HUD_ELEMENT_TEXTURE_OFFSET_X
HUD_ELEMENT_TEXTURE_OFFSET_Y


The following events are internal to MBot:

CLIENTMSG
A message is received from a client application connected to MBot running in Server Mode. The message will be contained in $clientmsg and the client IP address in $client. In version 4.3.16 and higher, the client index will be in @clientindex. If several clients at the same address are connected, the client index will allow you to tell them apart.

SVRMSG
A message is received from a server application connected to MBot running in Server Mode. The message will be contained in $svrmsg.

CLIENTCONNECT
This event occurs when a client attempts to connect to the server. (The event occurs in the Magsbot server.) The client address will be in $client. The @accepted variable will indicate if the client succeeded in connecting or not. In version 4.3.16 and higher, the client index will be in @clientindex. If several clients at the same address are connected, the client index will allow you to tell them apart.

CLIENTDISCONNECT
This event occurs when a client disconnects from the server. (The event occurs in the Magsbot server.) The client address will be in $client.  In version 4.3.16 and higher, the client index will be in @clientindex. If several clients at the same address are connected, the client index will allow you to tell them apart.

SURVEYDONE
A survey concludes.

TERRAINDONE
A terrain query concludes.

CLOCKTICK
(Clocktick events are triggered by MB's own timers, that you can control with the STARTTIMER and STOPTIMER actions:)

STARTUP
This event occurs when the MBot program begins.

TERMINATE
This event occurs when the MBot program ends.

ZONEENTER
This event occurs when an avatar enters a zone. Attributes $avname, @avsession and $atr[avatar_zone] are available.

ZONEEXIT
This event occurs when an avatar exits a zone. Attributes $avname, @avsession and $atr[avatar_zone] are available.

TERMINATEINSTANCE
This event occurs when a particular bot instance ends. See @instance_ and @session_. (Version 5.0.4, changed in version 5.0.5.)

RECOVER
This event occurs when a bot instance recovers after a disconnection. (Version 5.0.4).

ERROR
This event occurs when an MBot error occurs. Check @error to find the MB error code, or @sdkerror to find the SDK result code. $error contains the error message. MB error codes are listed here.

WORLDLISTDONE
Signals that a WORLDLIST query has completed..

ADMINWORLDLISTDONE
Signals an admin instance that an ADMINWORLDLIST query has completed.

WINMESSAGE
This event occurs when another copy of Magsbot running on the same computer, sends a Windows message using the WINMSG command. The @wparam and @lparam values sent by the other Magsbot will be available within the context of the event.

ANY
Rows of the Behavior Table with ANY in the Events column will always execute, even if checking is turned off usng the CHECK 0 Action. (The exception would be if an ENDCHECK action had been used in a subsequent row.)

You can use the ANY event and CHECK action to make parts of the Behavior Table invisible to some bot instances but not others. For instance:


State

Event

Action

On

ANY

CHECK @eq[$botname,"Wesley"]

<rows here are only checked by a bot instance that has the name "Wesley">


On

ANY

CHECK 1

<following rows are checked by all bot instances that has the name "Wesley">

(Bot Bone telegram system events:)

BLOGIN
Login message received, @berror contains the result.

BSTATUS
Status message received, $status contains name, @status contains result.

BPING
Ping returned, $bping contains name, @bping contains result.

BWELCOME
Welcome message received, $bwelcome contains message.

BGRAM
Telegram received, $sender contains name, $bgram contains message and $bchannel contains the channel name, if any,

BDISCONNECT
Disconnected from Bot Bone server.