SDK Global Mode

From ActiveWiki
Jump to navigation Jump to search

Beginning with version 3.3, the Active Worlds SDK supports a concept known as global mode. A bot running in global mode has access to every event occurring in the world regardless of where in the world the event occurs or how many users there are. Global mode obviates the need for stationing multiple bots across a world when it is necessary to monitor events across a wide area. Only bots running in caretaker mode can also run in global mode.

To activate global mode, an SDK application simply sets the attribute AW_ENTER_GLOBAL to 1 (true) before calling aw_enter. Note that global mode can only be set before entering a world. Once a bot has entered a world, changing the value of AW_ENTER_GLOBAL will have no effect. Bots cannot switch into and out of global mode while they are in a world. The application must leave the world and re-enter if it wishes to change its global mode state.

Once in global mode, the instance will receive notification of the following events (assuming the event handlers have been installed) regardless of the instance's position in the world. Note that for avatar update events, the instance does not need to call aw_state_change first in order to receive them, and for property events the instance does not need to call aw_query in order to be in live update mode.

Events affected by global mode

Usage

int rc;

aw_bool_set (AW_ENTER_GLOBAL, 1);

rc = aw_enter ("myworld");
if (rc != RC_SUCCESS)
{
  printf ("Unable to enter world (reason %d)\n", rc);
  exit (1);
}

if (!aw_bool (AW_WORLD_CARETAKER_CAPABILITY))
{
  printf ("Unable to enter world in global mode\n");
  exit (1);
}

See also