View Full Version : How do I get chat messages not to show up?
ChaosInc
11-10-2006, 06:15 PM
Mods like Chatr and WIM have the ability to supress messages from appearing in chat boxes. I'm almost done with my BG ignore mod. It recognizes ppl I choose to ignore, sends the message that their message was ignored in verbose/debug mode, but at the end the ignored message still appears in the chat frame. How do I get it to stop this? It's the only thing holding back the release.
Edit: I've tried looking at their codes, but it's all one jumbled mess to me that makes little sense.
freeri
12-10-2006, 12:37 AM
I suggest you to look at a guide posted on WoWWiki.com
HOWTO: Hook chatframes to modify or suppress messages (http://www.wowwiki.com/HOWTO:_Hook_chat_frames_to_modify_or_suppress_messages)
Sherkhan
12-10-2006, 12:37 AM
OK, I had to figure this out myself as well. To get the chat message to not show up, you need to overload the Chat function. Here is how I got something like that working:
-- in your addon OnLoad function / section add a hook to the ChatFrame_OnEvent function
old_ChatFrame_OnEvent = ChatFrame_OnEvent;
ChatFrame_OnEvent = lib_ChatFrame_OnEvent;
function lib_ChatFrame_OnEvent(event)
-- Code checks here to determine if the chat message is one you want to hide
-- event == one of the different chat type events "CHAT_MSG_CHANNEL" or "CHAT_MSG_WHISPER", etc...
-- arg9 would be a specific channel name - if this is some special chat channel other than Party, Raid, etc that have events associated with them
-- arg1 is the actual message text
-- Just check the event,arg9 if needed, then parse arg1 to see if it is a message you want to hide or block.
-- if it is a message you want to hide then just return, otherwise pass the message on to old_ChatFrame_OnEvent(event);
end
ChaosInc
12-10-2006, 03:59 PM
Thx for the help. WoWwiki had exactly what I was looking for, but I have one last issue now.
Code:
function ChatFrame_OnEvent(event)
-if (event == "CHAT_MSG_BATTLEGROUND") then
--if (XRI_Verbose) then
---DEFAULT_CHAT_FRAME:AddMessage("|cFFFF00FFXRI:|r Comparing author to list...");
---end;
--for num = 1, table.getn(XRI_List) do
---if arg2 == XRI_List[num] then --check if message is from a user you've ignored
----if (XRI_Verbose) then
-----DEFAULT_CHAT_FRAME:AddMessage("|cFFFF00FFXRI:|r Message ignored from ".. arg2.. ".");
----end;
----return;
---end;
--end;
-end;
-ORIG_ChatFrame_OnEvent(event);
end;
The mod screens and now removes messages from ignored ppl, but it's showing the verbose message "Comparing..." twice. I've tried moving "ORIG_ChatFrame_OnEvent(event);" figuring it's probably in the wrong spot. If I put it with an "else" in the initial compare, it shows that's it's comparing the author, but won't display ANY messages from the BG channel. Other places, chat doesn't function at all.
Sorry for the hassel. This is my first mod where I've actually had to hook into something and still not quite used to it. Going to release it for now and just put this known bug out right away.
Edit: BTW, on the double message, if it does find an author match, it doesn't display "Comparing" twice. The verbose messages work just fine then.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.