Thread Tools Display Modes
10-12-13, 06:02 AM   #21
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
They do, when you add the global string of the message ("You are now queued in the Raid Finder.") to your pattern list.

from GlobalStrings.lua
Lua Code:
  1. ERR_LFG_JOINED_RF_QUEUE = "You are now queued in the Raid Finder.";
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
10-12-13, 06:19 AM   #22
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by Rilgamon View Post
They do, when you add the global string of the message ("You are now queued in the Raid Finder.") to your pattern list.

from GlobalStrings.lua
Lua Code:
  1. ERR_LFG_JOINED_RF_QUEUE = "You are now queued in the Raid Finder.";
You're missunderstanding, that's not at all what i'm trying to filter, i'm guessing that one was taken because it has "now" in it, since my catch wasn't specific enough.

This is what i want to filter, but those just aren't:

Code:
ROLE_CHANGED_INFORM = "%s is now %s.";
ROLE_CHANGED_INFORM_WITH_SOURCE = "%s is now %s. (Changed by %s.)";
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote
10-12-13, 06:41 AM   #23
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by Caellian View Post
That's the part i don't get, since it has nothing to do with it.

Code:
MESSAGE: You are now queued in the Raid Finder. 0
Also, well i'm not sure yet, but it looks like it only doesn't work in battlegrounds, nothing gets printed at all.

Hard to tell for now. Doesn't make much sense tbh.
Is that what your addon prints when in your chat frame you see "[Player] is now [role]." or what are you saying?

Move the print(message) to outside of the if-block and see what it says when someone sets their role.



EDIT: Ok ok, it's not even a chat event, hah. :P
Code:
ROLE_CHANGED_INFORM(changed, from, oldRole, newRole)
You can probably just do this to remove these messages:
Code:
RoleChangedFrame:UnregisterEvent("ROLE_CHANGED_INFORM")
Now that I think of it, I seem to recall this from some other thread...
__________________
Grab your sword and fight the Horde!

Last edited by Lombra : 10-12-13 at 06:52 AM.
  Reply With Quote
10-12-13, 07:07 AM   #24
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Ups, did not expect that ... for the records:

http://wowprogramming.com/utils/xmlb...L/RolePoll.xml
Code:
    <Frame name="RoleChangedFrame" parent="UIParent">
        <Scripts>
            <OnLoad function="RoleChangedFrame_OnLoad"/>
            <OnEvent function="RoleChangedFrame_OnEvent"/>
        </Scripts>
    </Frame>
http://wowprogramming.com/utils/xmlb...L/RolePoll.lua

Lua Code:
  1. function RoleChangedFrame_OnLoad(self)
  2.     self:RegisterEvent("ROLE_CHANGED_INFORM");
  3. end
  4.  
  5. function RoleChangedFrame_OnEvent(self, event, ...)
  6.     if ( event == "ROLE_CHANGED_INFORM" ) then
  7.         local changed, from, oldRole, newRole = ...;
  8.          
  9.         if ( newRole == "NONE" ) then
  10.             if ( changed == from ) then
  11.                 ChatFrame_DisplaySystemMessageInPrimary(format(ROLE_REMOVED_INFORM, changed));
  12.             else
  13.                 ChatFrame_DisplaySystemMessageInPrimary(format(ROLE_REMOVED_INFORM_WITH_SOURCE, changed, from));
  14.             end
  15.         else
  16.             local displayedRole = _G["INLINE_"..newRole.."_ICON"].." ".._G[newRole];    --Uses INLINE_TANK_ICON, etc.
  17.             if ( changed == from ) then
  18.                 ChatFrame_DisplaySystemMessageInPrimary(format(ROLE_CHANGED_INFORM, changed, displayedRole));
  19.             else
  20.                 ChatFrame_DisplaySystemMessageInPrimary(format(ROLE_CHANGED_INFORM_WITH_SOURCE, changed, displayedRole, from));
  21.             end
  22.         end
  23.     end
  24. end
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
10-12-13, 07:41 AM   #25
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Sure these are events, but as you can see, there's something sent to chat "ChatFrame_DisplaySystemMessageInPrimary"

There's no need to unregister the event, there has to be a way to just filter the message, right ?

And the question is, why aren't the patterns catching them ?
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote
10-12-13, 07:52 AM   #26
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by Caellian View Post
Sure these are events, but as you can see, there's something sent to chat "ChatFrame_DisplaySystemMessageInPrimary"

There's no need to unregister the event, there has to be a way to just filter the message, right ?
Sure, you can override ChatFrame1.AddMessage and filter it out that way. Wouldn't recommend it, though. If your only mission is to suppress these messages, then unregister that event. The only purpose of RoleChangedFrame is to print out those messages, as far as I can tell. There's no reason to look for another way.

Originally Posted by Caellian View Post
And the question is, why aren't the patterns catching them ?
Because they aren't chat events. The chat filtering system doesn't work on any event, only CHAT_MSG_* events. Edit: To answer the exact question; because those messages never reach that pattern test. The pattern is fine.
__________________
Grab your sword and fight the Horde!

Last edited by Lombra : 10-12-13 at 07:55 AM.
  Reply With Quote
10-12-13, 09:17 AM   #27
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Code:
RoleChangedFrame:UnregisterAllEvents()
Works, obviously.

But it bothers me. Why the filtering way wouldn't work. I mean, those messages are sent to CHAT_MSG_SYSTEM right ?

So, if they are why can't i filter them there like just about anything else being sent to the chat ?
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote
10-12-13, 10:17 AM   #28
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by Caellian View Post
But it bothers me. Why the filtering way wouldn't work. I mean, those messages are sent to CHAT_MSG_SYSTEM right ?
They are not. CHAT_MSG_SYSTEM is a real event. Nothing is "sent to" being a chat event. When I say chat event I just mean the events that are handled by the chat frame. In this case the event is ROLE_CHANGED_INFORM, nothing else.
__________________
Grab your sword and fight the Horde!

Last edited by Lombra : 10-12-13 at 10:21 AM.
  Reply With Quote
10-12-13, 10:20 AM   #29
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by Lombra View Post
They are not.
ChatFrame_DisplaySystemMessageInPrimary ?

Or not, i don't know
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote
10-13-13, 02:39 AM   #30
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Caellian View Post
Thing is, with this, absolutely nothing gets printed. How can that be ?
It should only print something when a role changed message appears. If you're not playing in an English client, you'll need to change the " is now " search string to the appropriate text to match in your language.

Also, you may want to change the last line in topattern to escape all the "magic characters", not just parentheses. For my purposes it didn't matter, but if you're using it on other global strings, it might matter.

Code:
text = gsub(text, "([%(%)%.%%%+%-%*%?%[%^%$])", "%%%1")
__________________
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
10-13-13, 03:32 AM   #31
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by Phanx View Post
It should only print something when a role changed message appears. If you're not playing in an English client, you'll need to change the " is now " search string to the appropriate text to match in your language.
That's the thing, i am on an enGB client, playing on a frFR realm but that doesn't make any difference and the " is now " didn't catch anything.

Originally Posted by Phanx View Post
Also, you may want to change the last line in topattern to escape all the "magic characters", not just parentheses. For my purposes it didn't matter, but if you're using it on other global strings, it might matter.

Code:
text = gsub(text, "([%(%)%.%%%+%-%*%?%[%^%$])", "%%%1")
Done, i'll try again like this though i didn't notice any other special characters other than the (Changed by...)
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote
10-16-13, 08:53 AM   #32
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by Phanx View Post
Code:
text = gsub(text, "([%(%)%.%%%+%-%*%?%[%^%$])", "%%%1")
Phanx, this new line doesn't work when for example, switching between 2 specs on a hunter, "Your pet has unlearned..."
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » pattern matching

Thread Tools
Display Modes

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