WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Issue with CHAT_MSG_ADDON (https://www.wowinterface.com/forums/showthread.php?t=58735)

MinguasBeef 05-14-21 06:53 AM

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?

SDPhantom 05-14-21 07:35 AM

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.

MinguasBeef 05-14-21 08:19 AM

Quote:

Originally Posted by SDPhantom (Post 339125)
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!


All times are GMT -6. The time now is 11:22 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI