Thanks for the addon.
A small speed up fix if you like to:
Lua Code:
function NoMoreCarries.OnChat(self, eventKey, ...)
ifnot NoMoreCarries.active or eventKey ~= EVENT_CHAT_MESSAGE_CHANNEL thenreturnfalseend
local messageType, _, rawMessageText, _, fromDisplayName = select(1, ...)
local messageLower =string.lower(rawMessageText)
local _, achievementScore =string.gsub(messageLower, 'h1:achievement:', '')
local _, collectibleScore =string.gsub(messageLower, 'h1:collectible:', '')
local carryScore = achievementScore + collectibleScore
return carryScore >= NoMoreCarries.threshold
end
Will check if your addon is "ready" (event player activated) and the chat channel directly at the beginning of the function.
You could also try to add an event filter on the eventKey (if there exists such an event filtertype) -> See the wiki "Event filter"
This will happen before lua code is run and speeds up everythign at events a lot (like filtering non wanted message channels even before lua code hits).
Edit:
I've checked the wiki https://wiki.esoui.com/AddFilterForEvent
Unfortunately there is no chat channel event filter
but: Your current code also filters your own messages, isn't it? Is this intended? Maybe check for fromDisplayName ~= GetDisplayName()
Thanks for the addon.
A small speed up fix if you like to:
Lua Code:
function NoMoreCarries.OnChat(self, eventKey, ...)
ifnot NoMoreCarries.active or eventKey ~= EVENT_CHAT_MESSAGE_CHANNEL thenreturnfalseend
local messageType, _, rawMessageText, _, fromDisplayName = select(1, ...)
local messageLower =string.lower(rawMessageText)
local _, achievementScore =string.gsub(messageLower, 'h1:achievement:', '')
local _, collectibleScore =string.gsub(messageLower, 'h1:collectible:', '')
local carryScore = achievementScore + collectibleScore
return carryScore >= NoMoreCarries.threshold
end
Will check if your addon is "ready" (event player activated) and the chat channel directly at the beginning of the function.
You could also try to add an event filter on the eventKey (if there exists such an event filtertype) -> See the wiki "Event filter"
This will happen before lua code is run and speeds up everythign at events a lot (like filtering non wanted message channels even before lua code hits).
but: Your current code also filters your own messages, isn't it? Is this intended? Maybe check for fromDisplayName ~= GetDisplayName()
Thank you! Im still learning to code addons, so I appreciate a lot your feedback, excluding your own messages from the filter is something I didn't think about. Now I have something to do the next weekend!