WoW:API SendAddonMessage: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Move page script moved page API SendAddonMessage to WoW:API SendAddonMessage without leaving a redirect)
 
(17 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{wowapi}}
{{wowapi}} __NOTOC__
Sends a message to hidden AddOn channels. ('''new with patch 1.12''')
Sends a message to the hidden addon channel. Introduced in [[Patch 1.12]]. Replaced in 8.0 by C_ChatInfo.SendAddonMessage.
SendAddonMessage("prefix", "text", "type", "target");


SendAddonMessage("prefix", "text", "PARTY|RAID|GUILD|BATTLEGROUND")
== Parameters ==
 
=== Arguments ===
== Example ==
:;prefix
 
:: String - Message prefix, can be used as your addon identifier. (16 Character Limit)
SendAddonMessage("CTRA", "User Data: XYZ", "RAID");
:;text
:: String - Text to send.
:;type
:: String - AddOn channel to send to. Valid types are "PARTY", "RAID", "GUILD", "OFFICER", "BATTLEGROUND". As of 2.1, "WHISPER" was also added.
:;target
:: String - Used only for "WHISPER" communication - the player to whisper to.


== Example ==
SendAddonMessage( "CTRA", "User Data: XYZ", "RAID" );


== Notes ==
== Notes ==
 
* Calling this function results in the event [[Events/C#CHAT_MSG_ADDON|CHAT_MSG_ADDON]] being invoked on:
: Fires the Event [[Events_C_%28Cancel%2C_Character%2C_Chat%2C_Cinematic%2C_Clear%2C_Close%2C_Confirm%2C_Corpse%2C_Craft%2C_Current%2C_Cursor%2C_CVar%29#CHAT_MSG_ADDON|CHAT_MSG_ADDON]]
** <target>'s client if <type> is "WHISPER" or
 
** all clients in the <type> chat channel, otherwise
: The combined length of message plus prefix can be at most 254 characters.
* Messages sent to "RAID" while in a party will get delivered to "PARTY"
: The message will be unaffected by inebriation.
* To send to your battleground group, "BATTLEGROUND" must be used
: Messages sent to "RAID" when not in a raid will be delivered as if it had been sent as a "PARTY" message.
* Messages sent to <type> when you are not in the specified community will not be delivered.
: Using "RAID" or "PARTY" when not in a party or raid sends no message.  
* The message will not be affected by the player's level of [[Drunk|drunkenness]].
: (From [[Slouken]])
* The tab character ("\t") is used as a delimiter between the prefix and the message text
 
** because of this, \t can not be used as part of prefix
: The prefix cannot include a tab character ("\t") as it's used as a delimiter between the prefix and the text when the message is sent from the client. When the message is recieved by other clients, it's broken back in to two peices in the client and the sent to lua. Using a tab character in the text may be acceptable, but is unadvised.
** The combined length of message and prefix can be at most 254 characters (255th is the tab character used to delimit the two)
 
** length above 254 will disconnect you.
: The actual function name may end up being SendAddOnMessage() to be consistent with existing function names.
* except NULL (ASCII dec-ID 0) all characters (decimal ID 1-255) are allowed (in opposition to [[API SendChatMessage|SendChatMessage]] where many characters are disallowed)
 
* The "WHISPER" mode was added with patch 2.1, as servers will begin to rate throttle regular whispers to alleviate [[spam]] problems.
: If you want to send messages inbetween your battleground group you will need to use "BATTLEGROUND" instead of "RAID" or "PARTY".
* As of 2.1.0 whispers sent cross-server in battlefields will be sent as regular whispers and aren't hidden by the addon channel. (As of 2.4.3 this does not seem to be true: sending a message via WHISPER to another servers player was '''not''' sent as regular whisper. I did not test if the message was received properly. I think it worked because no "this player is offline" error message appeared.)

Latest revision as of 04:47, 15 August 2023

WoW API < SendAddonMessage

Sends a message to the hidden addon channel. Introduced in Patch 1.12. Replaced in 8.0 by C_ChatInfo.SendAddonMessage.

SendAddonMessage("prefix", "text", "type", "target");

Parameters

Arguments

prefix
String - Message prefix, can be used as your addon identifier. (16 Character Limit)
text
String - Text to send.
type
String - AddOn channel to send to. Valid types are "PARTY", "RAID", "GUILD", "OFFICER", "BATTLEGROUND". As of 2.1, "WHISPER" was also added.
target
String - Used only for "WHISPER" communication - the player to whisper to.

Example

SendAddonMessage( "CTRA", "User Data: XYZ", "RAID" );

Notes

  • Calling this function results in the event CHAT_MSG_ADDON being invoked on:
    • <target>'s client if <type> is "WHISPER" or
    • all clients in the <type> chat channel, otherwise
  • Messages sent to "RAID" while in a party will get delivered to "PARTY"
  • To send to your battleground group, "BATTLEGROUND" must be used
  • Messages sent to <type> when you are not in the specified community will not be delivered.
  • The message will not be affected by the player's level of drunkenness.
  • The tab character ("\t") is used as a delimiter between the prefix and the message text
    • because of this, \t can not be used as part of prefix
    • The combined length of message and prefix can be at most 254 characters (255th is the tab character used to delimit the two)
    • length above 254 will disconnect you.
  • except NULL (ASCII dec-ID 0) all characters (decimal ID 1-255) are allowed (in opposition to SendChatMessage where many characters are disallowed)
  • The "WHISPER" mode was added with patch 2.1, as servers will begin to rate throttle regular whispers to alleviate spam problems.
  • As of 2.1.0 whispers sent cross-server in battlefields will be sent as regular whispers and aren't hidden by the addon channel. (As of 2.4.3 this does not seem to be true: sending a message via WHISPER to another servers player was not sent as regular whisper. I did not test if the message was received properly. I think it worked because no "this player is offline" error message appeared.)