Thread Tools Display Modes
05-14-21, 06:53 AM   #1
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Issue with CHAT_MSG_ADDON

On the TBC beta, it seems like sending addon messages isn't working properly.

I might be just doing something wrong.

When I am sending the addon chat msg, I am triggering my event. When my party member sends it, the event is not triggered.

Here is the code for my frame.
Code:
local function CHAT_MSG_ADDON_CALLBACK(prefix, msg, type, sender)
    print("Chat message addon callback triggered!")
    print("prefix: " .. prefix)
    print("msg: " .. msg)
    print("type: " .. type)
    print("sender: " .. sender)
end

local function FrameEventCallback(event, ...)
    if (event == "CHAT_MSG_ADDON") then
        CHAT_MSG_ADDON_CALLBACK(...)
    end
end

local f = CreateFrame("Frame")
f:SetScript("OnEvent", 
function(self, event, ...)
    FrameEventCallback(event, ...)
end)

f:RegisterEvent("CHAT_MSG_ADDON")
Here is the code being used to trigger the event.
Code:
/run C_ChatInfo.SendAddonMessage("TEST EVENT", "Some Value")
When I run it, I see the message in chat just like i'd expect. When my party member runs it, I see nothing.

Any ideas?
  Reply With Quote
05-14-21, 07:35 AM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Did you register your prefix with C_ChatInfo.RegisterAddonMessagePrefix()?

Also if you don't specify a channel, C_ChatInfo.SendAddonMessage() sends in PARTY. For testing, you might want to try SAY.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-14-21 at 07:38 AM.
  Reply With Quote
05-14-21, 08:19 AM   #3
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Originally Posted by SDPhantom View Post
Did you register your prefix with C_ChatInfo.RegisterAddonMessagePrefix()?

Also if you don't specify a channel, C_ChatInfo.SendAddonMessage() sends in PARTY. For testing, you might want to try SAY.
Right, the intention was to send over party and that's why I did not pass anything in for the party/target parameters.

I did not know about registering the addon prefix. That fixed it. Thanks!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Issue with CHAT_MSG_ADDON

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off