View Single Post
09-20-09, 10:17 AM   #4
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
%s in a patterns matches a space so instead of replacing it with %s- you would instead probably need to replace it with a .+, I know cargor probably knows this and has just made a silly mistake :P
lua Code:
  1. local patterns = {}
  2. local limit = 4
  3. for i = 1, limit do
  4.     patterns[(i*2)-1] = _G["DRUNK_MESSAGE_ITEM_OTHER"..i]:gsub("%%s", "%s-")) -- odd
  5.     patterns[i*2] = _G["DRUNK_MESSAGE_OTHER"..i]:gsub("%%s", "%s-") -- even
  6. end
  7.  
  8. local function intox(f, e, msg)
  9.     for i = 1, limit * 2 do
  10.         if msg:find(pattern) then
  11.             return true
  12.         end
  13.     end
  14.     return false
  15. end
  16.  
  17. ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", intox)
is what I would use.

edit: Grrrr why on earth can't [highlight] handle parenthesis .

Last edited by Slakah : 09-20-09 at 10:20 AM.
  Reply With Quote