RSS

Четверг, 14.11.2024, 18:57
Главная » WoW API » API Функции » Связанные с аддонами »

SendAddonMessage

[ править ]
Sends a chat-like message receivable by other addons.
[клоны]
Sends a chat-like message receivable by other addons. Allows for client-to-client addon communication.

Unlike with SendChatMessage, messages sent via SendAddonMessage:

  • do not appear in receiving players' chat windows (unless an addon explicitly prints them)
  • are not subject to strict server-side spam filtering/throttling (sending too many messages at once can still disconnect the user)
  • are not modified if the sending character is drunk

Messages are received via the CHAT_MSG_ADDON event. The client utilizes the prefix string to filter messages; only those prefixes which have been registered will be received. Prefixes can be registered using RegisterAddonMessagePrefix.
Signature:
Code
SendAddonMessage("prefix", "message" [, "type" [, "target"]])

Arguments:
  • prefix - An arbitrary label for the message. Allows receiving addons to filter incoming messages: for example, if an addon uses the same prefix for all messages it sends, an addon interested in only those messages can check for that prefix before handling the message content. Cannot contain the tab character (\t). (string)
  • message - A message to send; combined length of prefix and message is limited to 254 characters (string)
  • type - Scope in which to broadcast the message: (string)
      BATTLEGROUND - To all allied players in the current battleground instance
    • GUILD - To all members of the player's guild
    • OFFICER - To all guild officers
    • PARTY - To all members of the player's party (used by default if no type is given)
    • RAID - To all members of the player's raid group (automatically reverts to sending to party if the player is not in a raid group)
    • WHISPER - To a specific player

  • target - If type is "WHISPER", the name of the target player (in cross-realm battlegrounds, the format "Name-Realm" can be used to target a player from another realm; e.g. "Thott-Cenarius") (string)

Examples:
-- Hypothetical communication using addon messages
local MSG_PREFIX = "MY_MOD"
SendAddonMessage(MSG_PREFIX, "Resync", "GUILD")
SendAddonMessage(MSG_PREFIX, "VersionCheck", "WHISPER", "username")

Также смотрите: Связанные с аддонами , Addon-related functions
Ссылки: http://wowprogramming.com/docs/api/SendAddonMessage