VP EVENT AVATAR ADD: Difference between revisions
Jump to navigation
Jump to search
Roy Curtis (talk | contribs) avatar_add - please check caveats for accuracy / clarity |
Roy Curtis (talk | contribs) m avatar type |
||
Line 4: | Line 4: | ||
|attributes= | |attributes= | ||
{{sdk attribute row|int |avatar_session|Session ID of entering client}} | {{sdk attribute row|int |avatar_session|Session ID of entering client}} | ||
{{sdk attribute row|int |avatar_type |'' | {{sdk attribute row|int |avatar_type |''Unused'' - Client's current avatar}} | ||
{{sdk attribute row|int |user_id |ID of the entering client's user account}} | {{sdk attribute row|int |user_id |ID of the entering client's user account}} | ||
{{sdk attribute row|string|avatar_name |Name of entering client}} | {{sdk attribute row|string|avatar_name |Name of entering client}} |
Latest revision as of 19:36, 25 August 2013
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