Thread Tools Display Modes
03/01/20, 11:56 AM   #1
Shadowfen
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 83
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?
  Reply With Quote
03/01/20, 03:09 PM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
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?
  Reply With Quote
03/01/20, 04:21 PM   #3
Shadowfen
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 83
Originally Posted by sirinsidiator View Post
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.
  Reply With Quote
03/02/20, 12:15 PM   #4
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
I've uploaded a new version of LCM. The workaround is no longer needed with today's patch, so I removed the code.
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » chat /reply /respond /r problem

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