PDA

View Full Version : Need some help with system chat, please.


simonseztech
24-06-2007, 11:03 PM
Ok I want to hide specific system message here what I have so far...

This fuction got triggered when event == "CHAT_MSG_SYSTEM"

function BgMsg_CatchMsgSystem()
msg = arg1;
i, j = string.find(msg, "the battle")
if i ~= nil then
BGMSG_Print("CHATMSGSYSTEM CATCH"..msg)
end;
end;

So far all "User has joined the battle" and "User has left the battle" trigger
my print.

My question is how do I hide them ? and
what is the pattern to search "has * the battle" ?

Any help will be great thanks.

Duugu
24-06-2007, 11:48 PM
Hook ChatFrame_MessageEventHandler(event)
Then test in your function if arg1 contains "has * the battle"
If not call the old ChatFrame_MessageEventHandler(event)
To find a string use http://www.lua.org/manual/5.1/manual.html#pdf-string.find or http://www.lua.org/manual/5.1/manual.html#pdf-string.gmatch

simonseztech
25-06-2007, 01:34 AM
Thanks Duugu for your help. I hide the message I want using "the battle"

but when I put


i, j = string.find(msg, "has %a the battle")


it doesn't work. any clue ?

Telic
25-06-2007, 01:56 AM
Try changing '%a' to '%a+'


Some good info at :

http://www.lua.org/pil/20.2.html

simonseztech
25-06-2007, 05:32 AM
thanks working fine...