View Single Post
03-21-13, 08:56 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
He wants something that will alert him when someone talks in General chat saying Sha/Galleon/whatever is up.

Okay, ChatAlerts looks pretty useless then... why would you write a chat alert addon that can't actually monitor the channels that are hardest to monitor on your own?

Anyway, this will monitor numbered channels for messages containing "sha" or "galleon" and re-print those messages to the UIErrorsFrame. Should work unless ElvUI is breaking the UIErrorsFrame, though that wouldn't surprise me, since ElvUI seems to break everything and be imcompatible with everything and its author refuses to fix any and all compatibility issues.

Code:
local words = { -- MUST BE LOWERCASE
    "sha",
    "galleon",
}
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, channelID)
    if channelID == 0 or type(channelID) ~= "number" then return end -- ignore custom channels
    local lowermessage = strlower(message)
    for i = 1, #words do
        if strfind(lowermessage, words[i]) then
            UIErrorsFrame:AddMessage(message, 1, 0.75, 0.75)
        end
    end
end)
Use http://addon.ziuo.net/ to turn it into an addon if you don't know how.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote