In addition:
The gsub(), as you already said, is necessary to match the pattern correctly, because "%s" would only match one character, but we need to match multiple ones.
Code:
local function intox(frame, event, msg, ...)
for i=1,4 do
-- access the global variable
local drunk1 = _G["DRUNK_MESSAGE_ITEM_OTHER"..i]:gsub("%%s", "%s-")
local drunk2 = _G["DRUNK_MESSAGE_OTHER"..i]:gsub("%%s", "%s-")
if msg:match(drunk1) or msg:match(drunk2) then
return true
end
end
return false -- this is probably implied and not needed
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", intox)