VP EVENT CHAT: Difference between revisions

From Virtual Paradise Wiki
Jump to navigation Jump to search
Roy Curtis (talk | contribs)
Created page with "{{sdk event page|Chat|This event may be received when: * A chat message is sent to the world from a {{sdk function|say}} call * When a console message is received from a {{sdk..."
 
Roy Curtis (talk | contribs)
+caveat on console message security
 
Line 16: Line 16:
* Clients will not receive their own chat messages
* Clients will not receive their own chat messages
* Clients however will receive their own console messages if they are sent to all sessions ({{code|0}})
* Clients however will receive their own console messages if they are sent to all sessions ({{code|0}})
* For console messages, {{sdk attribute|string|avatar_name|tag=}} may be an empty string, which is valid...
* For console messages, it is possible and valid for {{sdk attribute|avatar_name}} to be an empty string
** ...but it may also be the name of another client present. Care should be taken to identify console messages that impersonate other users.
|caveats=
Clients may send console messages with any {{sdk attribute|avatar_name}} string, including names of other clients. Care should be taken to identify console messages that impersonate other users, at least by ignoring console messages or only using {{sdk attribute|avatar_session}} as the source's identity.
|examples=
|examples=
|seealso=
|seealso=
}}
}}

Latest revision as of 05:40, 25 August 2013

Event set and handler snippet

vp_event_set(instance, VP_EVENT_CHAT, event_chat);

void event_chat(VPInstance instance) { }

This event may be received when:

  • A chat message is sent to the world from a vp_say() call
  • When a console message is received from a vp_console_message() call

Attributes

Attribute Usage
VP_CHAT_TYPE Type of chat received
VP_AVATAR_SESSION Source session ID of the chat message
VP_AVATAR_NAME Source or custom associated name of the chat message
VP_CHAT_MESSAGE Chat message itself
If VP_CHAT_TYPE == VP_CHAT_CONSOLE_MESSAGE...
VP_CHAT_EFFECTS Console message text effects bitfield
VP_CHAT_COLOR_RED Console message red color component
VP_CHAT_COLOR_GREEN Console message green color component
VP_CHAT_COLOR_BLUE Console message blue color component

Behavior

  • Clients will not receive their own chat messages
  • Clients however will receive their own console messages if they are sent to all sessions (0)
  • For console messages, it is possible and valid for VP_AVATAR_NAME to be an empty string

Caveats

Clients may send console messages with any VP_AVATAR_NAME string, including names of other clients. Care should be taken to identify console messages that impersonate other users, at least by ignoring console messages or only using VP_AVATAR_SESSION as the source's identity.

Examples

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