ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   AddOn Help/Support (https://www.esoui.com/forums/forumdisplay.php?f=164)
-   -   chat /reply /respond /r problem (https://www.esoui.com/forums/showthread.php?t=9006)

Shadowfen 03/01/20 11:56 AM

chat /reply /respond /r problem
 
The problem is that trying to use the /r in chat to respond to a whisper fails to do anything when LibChatMessage is in "hack-around" mode.

Proof of concept minimal addon src:
Code:

chatTest = {
    name = "chatTest",
}

-- Registering libraries
local LCM = LibChatMessage

-- ugly message formatter
local function FormatMessage(chanCode, from, text, isCS, fromDisplayName)
    local message = string.format("[%s/%s] %s",zo_strformat(SI_UNIT_NAME, from), fromDisplayName, text)
    return message
end

-- Registers the FormatMessage function with the LibChatMessage to handle chat formatting.
local function OnPlayerActivated()

    EVENT_MANAGER:UnregisterForEvent(chatTest.name, EVENT_PLAYER_ACTIVATED)

    -- set the chat event handlers for LibChatMessage to use
    LCM.formatRegularChat = true
    local evthdlrs = ZO_ChatSystem_GetEventHandlers()
    evthdlrs[EVENT_CHAT_MESSAGE_CHANNEL] = FormatMessage
end

--
local function OnAddonLoaded(_, addonName)
    if addonName ~= chatTest.name then return end
    EVENT_MANAGER:UnregisterForEvent(chatTest.name, EVENT_ADD_ON_LOADED)
 
        EVENT_MANAGER:RegisterForEvent(chatTest.name, EVENT_PLAYER_ACTIVATED, OnPlayerActivated)
end

EVENT_MANAGER:RegisterForEvent(chatTest.name, EVENT_ADD_ON_LOADED, OnAddonLoaded)

When the line
Code:

evthdlrs[EVENT_CHAT_MESSAGE_CHANNEL] = FormatMessage
is commented out, the /r works normally.

When the line is not commented, the /r chat command fails to work. :(

Anyone have any ideas?

sirinsidiator 03/01/20 03:09 PM

That's strange. Haven't tried your code specifically, but it works fine for me while the workaround is active and I also don't see how it would interfere with the /r switch, since that is not at all related to the message formatting or anything the workaround is doing. Did you test this with only your addon and LCM active? Maybe some other chat addon is interfering?

Shadowfen 03/01/20 04:21 PM

Quote:

Originally Posted by sirinsidiator (Post 40430)
That's strange. Haven't tried your code specifically, but it works fine for me while the workaround is active and I also don't see how it would interfere with the /r switch, since that is not at all related to the message formatting or anything the workaround is doing. Did you test this with only your addon and LCM active? Maybe some other chat addon is interfering?

I tested with the chatTest addon that I provided code for and LCM; nothing else.

sirinsidiator 03/02/20 12:15 PM

I've uploaded a new version of LCM. The workaround is no longer needed with today's patch, so I removed the code.


All times are GMT -6. The time now is 11:19 AM.

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