Thread Tools Display Modes
10-20-05, 09:57 AM   #1
Nydidric
A Defias Bandit
Join Date: Oct 2005
Posts: 2
How to detect GM Messages

Hello...

I'am developing a simple mod to ignore all wispers, it works also fine but i have a problem with the GM Messages. The Mod will help the priests to make Roleplay and they dont get crasy because they get all 5 sec. a question to help in a dungeon.

I'am seachring for a solution to detect when a GM send you a wisper message. I dont want to ignore GM messages.

First of all i have to ask, is a GM message also a wisper.. and if it is, it's possible to detect if the message come from a player or a GM ?

I hope u can give me a answer..
Thanks.

Last edited by Nydidric : 10-20-05 at 10:02 AM.
  Reply With Quote
10-20-05, 01:32 PM   #2
Gorak
A Fallenroot Satyr
Join Date: Oct 2005
Posts: 21
Hmm..

Since most players use the primary chat frame to receive and send chat messages, a viable solution might be to use the new 1.8. script replacement functions to get a local copy of the OnEvent handler for the chat frame.

You would then proceed to filter CHAT_MSG_WHISPER messages, if the sender's name does not contain <GM> prefix tag, which all Game Masters have. If such a tag is detected, the old routine is called.

Using a script hooker is better for two reasons, as it doesn't clump up your ignore list, and it can be easily detached to allow the messages flow through again. Naturally, this solution will cause problems if another add-on manages to hook the handler first, and is dependant on whisper messages, such as auto-buff-on-whisper add-ons.
  Reply With Quote
10-20-05, 05:40 PM   #3
noraj
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 102
yeah the only constants is the <GM> tag...and it is a normal wisper
  Reply With Quote
10-21-05, 03:01 AM   #4
Nydidric
A Defias Bandit
Join Date: Oct 2005
Posts: 2
Thanks a lot..

I was thinking about this solution but i was not sure if is the tag <GM> in the name or a separated tag.

And i hook the funktion ChatFrame_OnEvent function and filter only the CHAT_MSG_WHISPER out if the addon is activated. I check also if its a friend or a guild member how wipsers.

like this
Code:
...
function WisperIgnore_OnLoad()
	this:RegisterEvent("VARIABLES_LOADED");
	
	-- hook the chatframe event function
	WisperIgnore_Original_ChatFrame_OnEvent = ChatFrame_OnEvent;
	ChatFrame_OnEvent = WisperIgnore_ChatFrame_OnEvent;
	
	-- set the slash commands
	SlashCmdList["WIGNORE"] = function(msg) WisperIgnore_Cmd(msg); end
	SLASH_WIGNORE1 = "/wignore";
end

function WisperIgnore_ChatFrame_OnEvent(event, ...)
	if (not WisperIgnore_IsPlayerFriend(arg2) and not WisperIgnore_IsGM(arg2) and not WisperIgnore_IsPlayerGuildMembers(arg2)) then
		if (event == "CHAT_MSG_WHISPER" and WisperIgnore_Activ) then
			-- return when the response is form a WisperIgnore Addon
			if( string.find(arg1, "(OOC: WisperIgnore)" ) ) then
				return;
			end
			WisperIgnore_Print("WisperIgnore: Wisper ignoriert von "..arg2);
			WisperIgnore_SendIgnoreMessage(arg2);
			return;
		else
			WisperIgnore_Original_ChatFrame_OnEvent(event, unpack(arg));
		end
	else
			WisperIgnore_Original_ChatFrame_OnEvent(event, unpack(arg));
	end
end
...

Last edited by Nydidric : 10-21-05 at 03:20 AM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How to detect GM Messages


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