View Single Post
09-27-15, 02:31 AM   #17
Gryns
A Deviate Faerie Dragon
 
Gryns's Avatar
Join Date: Sep 2015
Posts: 11
Originally Posted by semlar View Post
It's not looking for names with quotes around them, the %f[] at the start and end of the pattern contains a character class representing a transition from any of the characters inside of the brackets to the characters in the name itself.

%s matches any whitespace and %z essentially matches "nothing", which allows it to match the name if it's at the start or end of the message.

So, since "Gryns-Aggramar" is surrounded by quotes and not spaces, the pattern fails.

Add double-quotes to the frontier pattern to allow them to match.
Lua Code:
  1. ChatFrame_AddMessageEventFilter('CHAT_MSG_TEXT_EMOTES', function(self, event, msg, ...)
  2.     return false, (msg:gsub('%f[^%z%s"]([^\1-\64\91-\96\123-191]+)%-%u%l%a+%f[%z%s"]', '%1')), ...
  3. end)
Thanks for the explanation. The thing is, I just added the quotes there to underline how the character name is displayed. The quotes are not there in-game. It just uses the name with the realm suffix. Perhaps the reason that this particular piece of code only grabs certain emotes is because it is looking for the name at the start or ending of the sentence?

But I looked up other character classes and tried some other combinations. But none of them seem to work. I'm trying to get the code to look for anything with a hyphen, and then remove the realm suffix.

This is how I tried editing your code:

Lua Code:
  1. ChatFrame_AddMessageEventFilter('CHAT_MSG_TEXT_EMOTES', function(self, event, msg, ...)
  2.     return false, (msg:gsub('%f[-]([^\1-\64\91-\96\123-191]+)%-%u%l%a+%f[%z%s"]', '%1')), ...
  3. end)

This apparently isn't working, and neither are the combinations %f[^-], %f[^%z-], %f[%z%s-]. Any idea how I should try to do it?

Thanks again.
__________________
-- Live like a King, laugh like his Jester. --
  Reply With Quote