_ is just a common way of basically telling the game "I don't care about this" -- in this case, it's in the slot for the message, and we only care about the name.
I only actually posted two versions (well three now). The other posters weren't me.
If you'd like to add customisable phrases that's certainly doable. Note that in this version the {} are not optional, but the comma and second phrase are. If you omit that part, it will use the default:
Code:
local me = CreateFrame("Frame")
me:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
me:RegisterEvent("CHAT_MSG_MONSTER_SAY")
me:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
--add any others...that's probably good enough
me.listOfNames = {
{"Ringo"},
{"Kerlonian Evershade", "Darn it! That lazy druid has fallen asleep again, use the horn!!!"},
{"Shay"},
{"A-Me 01"},
--etc
}
me.EventHandler(self, event, _, name)
for i = 1, #self.listOfNames do
if name:find(self.listOfNames[i][1]) then
PlaySound("RaidWarning")
local msg = self.listOfNames[i][2] or "Heads Up! Your quest NPC needs help!!!"
RaidWarningFrame:AddMessage(msg)
return
end
end
end
me:SetScript("OnEvent", me.EventHandler)
edit: matrix fail -_-