Hello, i've started doing weakaura recently and am still struggling. i'd like to make a weakaura that read a certain word on the chat, and counting the word till the end of a fight, and show at the end the number of time each person on my raid said that certain word. So far i'm trying to read /say chat, but seems like I have a problem somewhere.
#read /say chat in weakaura, and counting a certain occurence
57 messages · Page 1 of 1 (latest)
you're using a TSU but I think you're misunderstanding some of how they work
what is your MsgFound arg for?
You selected the one option that says "advanced" and you have to use th correct order for the Args. You applied them very random.
also your list could be built once and accessed by key, instead of having to loop through it on each message
And the included var isn't needed, just return.
hum, im fairly new, im not sure to understand, and i tried to pick things i found on internet :/
the goal is : increment each person who say something on /say chat on this variable
not sure if the tertiary operator will work how I want to here but this is roughly how I'd do it
scrap the TSU and just use a custom -> event trigger with some code like this
function(event, ...)
if event == "CHAT_MSG_SAY" and ... then
local sender, text = ...
if strlower(text) == "boing" and aura_env.playerList[sender] then
if aura_env.listOccurrence[sender] then
aura_env.listOccurrence[sender] = aura_env.listOccurrence[sender] + 1
else
aura_env.listOccurrence[sender] = 1
end
end
return true
end
does it "add" new player that sais "boing" the first time ? seems like they will not pass the "aura_env.playerList[sender] condition
perfect
I assumed that player list was a config table that you're using to filter for specific players
otherwise it's not needed and you can scrap that check
seems like its counting now, can we run a function when the weakaura unload ? so that it shows on chat every person count ?
yeah if you go to the actions tab and find "on hide" you can loop through your tally and print to the display
@dim crypt do you know if aura_env gets cleared on unload? or whether we need to manually do it here on encounter start/end
nvm this won't work, we're not triggering on encounter end
oh :/
maybe i can load the weakaura when i want, and just reset the list on pull, and show on wipe ?
Yes.
I tweaked it a bit, try this
function(event, ...)
if event == "ENCOUNTER_START" and ... then
aura_env.counts = {}
elseif event == "ENCOUNTER_END" and ... then
for player, count in pairs(aura_env.counts) do
print(player .. ": " .. count .. " boings.")
end
elseif string.find(event, "CHAT_MSG") and ... then
local text, playerName = ...
if strlower(text) == "boing" then
if aura_env.counts[playerName] then
aura_env.counts[playerName] = aura_env.counts[playerName] + 1
else
aura_env.counts[playerName] = 1
end
end
end
return true
end
I am personally a fan of the pattern
If not array[X] then array[X] = 0
idk how the other one was working because it was grabbing the sender as the first arg and checking that for boings
It wasnt
ye must've been a false positive
note that if you're using that code you need to add ENCOUNTER_START and ENCOUNTER_END to your events section
ye i saw that
the CHAT_MSG code will run on any event that you listen for too, so _RAID _PARTY etc
to debug and be sure it works, can i replace encounter_start and encounter_end with something else ?
like fighting against dummy
if you only care about say just check for it, the find is wasted processing in that case
PLAYER_REGEN_DISABLED and PLAYER_REGEN_ENABLED
double check your load condition too
its the outside combat regen ?
_DISABLED fires when combat starts
can you post your code and events here?
function(event, ...)
if event == "PLAYER_REGEN_DISABLED" and ... then
aura_env.counts = {}
elseif event == "PLAYER_REGEN_ENABLED" and ... then
for player, count in pairs(aura_env.counts) do
print(player .. ": " .. count .. " boings.")
end
elseif event == "CHAT_MSG_SAY" and ... then
local text, playerName = ...
if strlower(text) == "boing" then
if aura_env.counts[playerName] then
aura_env.counts[playerName] = aura_env.counts[playerName] + 1
else
aura_env.counts[playerName] = 1
end
end
end
return true
end
a lua error is occuring somewhere it seems
if you want to remove the realm name from your print you can call Ambiguate() like this
print(Ambiguate(player, "short") .. ": " .. count .. " boings.")
like this
can we send that in /say chat ?
you can, your guild/pugs will probably hate you though
dw its for guild
anything spammy like this is usually beft left to personal prints
but should you wish to annoy your friends, replace print with this function: https://warcraft.wiki.gg/wiki/API_SendChatMessage
Warcraft Wiki
Sends a chat message.
SendChatMessage(msg [, chatType, languageID, target])