VP_EVENT_AVATAR_ADD

From Virtual Paradise Wiki
Jump to navigation Jump to search
Event set and handler snippet

vp_event_set(instance, VP_EVENT_AVATAR_ADD, event_avatar_add);

void event_avatar_add(VPInstance instance) { }

This event is received:

  • For each client that was already present in the world when the receiving client connects to it
  • For each client that subsequently enters the world whilst the receiving client is connected to it

Attributes

Attribute Usage
VP_AVATAR_SESSION Session ID of entering client
VP_AVATAR_TYPE Unused - Client's current avatar
VP_USER_ID ID of the entering client's user account
VP_AVATAR_NAME Name of entering client
VP_AVATAR_X Entering client's X coordinate
VP_AVATAR_Y Entering client's Y coordinate
VP_AVATAR_Z Entering client's Z coordinate
VP_AVATAR_PITCH Entering client's pitch rotation
VP_AVATAR_YAW Entering client's yaw rotation

Behavior

There is no special behavior for this event

Caveats

A common pitfall for bot developers is to make a bot say something when this event fires. Because this event is sent for every user already in the world when the bot logs in, the chat may suddenly gets spammed. For example, in a world with six users, the following may happen within a second timespan:

*** [FriendlyBot] has entered VP-Build
[FriendlyBot]    Hello, UserA!
[FriendlyBot]    Hello, UserB!
[FriendlyBot]    Hello, UserC!
[FriendlyBot]    Hello, UserD!
[FriendlyBot]    Hello, [BotA]!
[FriendlyBot]    Hello, [BotB]!

To prevent this from happening, it is best to only say something when at least a number of seconds have passed since the bot last entered the world. Otherwise, the event should just be ignored or only do utility things such as adding the avatars to a tracking list or array.

Examples

This event has no usage examples; please add at least one to this page