AW EVENT AVATAR ADD
From ActiveWiki
| Minimum requirements | ||
|---|---|---|
| Added in version 2.1 | ||
| SDK | build 13 | |
AW_EVENT_AVATAR_ADD
[edit] Description
An avatar was added as a neighbor.
[edit] Notes
This event can be received for avatars that come within neighbor range of an instance. Instances that do not have public speaker capability also have a limit to the number of neighbors they can have.
In order to receive the event, an instance must first announce its position by calling aw_state_change at least once, or enter the world in global mode.
It is possible for this event to be triggered repeatedly for the same avatar, without an AW_EVENT_AVATAR_DELETE occurring in between the events. This situation arises when an instance reconnects to a world after being disconnected. To avoid duplicate avatar entries in a session-tracking table, clear all entries when an AW_EVENT_WORLD_DISCONNECT occurs.
Some methods, like aw_say and aw_whisper, will only work on neighbors.
[edit] Attributes
- AW_AVATAR_SESSION
- AW_AVATAR_NAME
- AW_AVATAR_X
- AW_AVATAR_Y
- AW_AVATAR_Z
- AW_AVATAR_YAW
- AW_AVATAR_TYPE
- AW_AVATAR_GESTURE
- AW_AVATAR_VERSION
- AW_AVATAR_CITIZEN
- AW_AVATAR_PRIVILEGE
- AW_AVATAR_PITCH
- AW_AVATAR_STATE
- AW_PLUGIN_STRING
[edit] Usage
Say "Hello <name>" to every avatar that enters the scene.
- Caution: This example is only valid for bots that have called aw_state_change, and are not solely relying on global mode to handle AW_EVENT_AVATAR_ADD.
void avatar_add (void)
{
char message[256];
sprintf (message, "Hello %s", aw_string (AW_AVATAR_NAME));
aw_say (message);
}
aw_event_set (AW_EVENT_AVATAR_ADD, avatar_add);
aw_state_change ();
