lua Code:
local function intox(frame, event, msg, ...)
for i=1,4 do
if msg:match("DRUNK_MESSAGE_ITEM_OTHER"..i) then
msg:gsub("%%s", ".*")
elseif msg:match("DRUNK_MESSAGE_OTHER"..i) then
msg:gsub("%%s", ".*")
end
end
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", intox)
Few problems:
* In a message event filter, you return true to filter the message completely, return false to let it pass unaltered, or return a modified string and the vararg to modify the message.
* The DRUNK_MESSAGE_ITEM_OTHERN and DRUNK_MESSAGE_OTHERN are global variables. You're just comparing your message to a direct string called DRUNK_MESSAGE_ITEM_OTHERN, etc. You want to access the variable.
Code:
local function intox(frame, event, msg, ...)
for i=1,4 do
-- access the global variable
if msg:match(_G["DRUNK_MESSAGE_ITEM_OTHER"..i]) or msg:match(_G["DRUNK_MESSAGE_OTHER"..i]) then
return true
end
end
return false -- this is probably implied and not needed
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", intox)
Something like that, ish.