VP_EVENT_AVATAR_DELETE

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

vp_event_set(instance, VP_EVENT_AVATAR_DELETE, event_avatar_delete);

void event_avatar_delete(VPInstance instance) { }

Received when a client leaves the currently connected world

Attributes

Attribute Usage
VP_AVATAR_SESSION Session ID of leaving client
VP_AVATAR_NAME Name of leaving client

Behavior

Contrary to VP_EVENT_AVATAR_ADD's behavior when entering a world, this event is not fired for every client in the world if:

  • The world is changed with vp_enter() or left with vp_leave()
  • There is an unexpected disconnection from the world or universe server
  • The instance is destroyed with vp_destroy()

Caveats

Due to the above behavior, bots that are keeping track of clients through a list along with VP_EVENT_AVATAR_ADD and VP_EVENT_AVATAR_DELETE should clear it if any of the above occur. Otherwise, the bot's list may become out-of-sync with the server's list. For example:

  • Bot enters the world
  • Client A enters the world; Bot adds it to internal list
  • Client B enters the world; Bot adds it to internal list
  • Bot unexpectedly disconnects from the world
  • Client A leaves the world
  • Bot reconnects to the world
  • Bot sees Client B "enter" again and adds it to internal list
  • Bot's list now consists of: Client A, Client B, Client B

Examples

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