Chat Parser
Description: This simple chat parser will watch all chats, whispers, says, and yells for text patterns you specify. Then you can dump then out and clear them. This is more a proof of concept on how to monitor chat than anything, in reality you'd probably want to do something more interesting.
How to use: Execute on events (put them all in the event name box, comma-separated): CHAT_MSG_CHANNEL, CHAT_MSG_WHISPER, CHAT_MSG_SAY and CHAT_MSG_YELL.
if (not savedText) then
savedText = {}
end
-- full regex is supported, see http://www.lua.org/manual/5.0/manual.html#5.3
interestingPatterns = {
"WTS",
"%dg",
"UBRS",
}
for i, pat in interestingPatterns do
if (string.find(msg, pat)) then
table.insert(savedText, author..": "..msg)
end
end
One more script to dump out and clear what the script has captured:
-- show interesting text
DEFAULT_CHAT_FRAME:AddMessage("Found "..table.getn(savedText).." interesting messages.")
for i, text in savedText do
DEFAULT_CHAT_FRAME:AddMessage(text)
end
-- and reset it
savedText = {}