Thread Tools Display Modes
Prev Previous Post   Next Post Next
02-25-13, 05:47 AM   #1
shalom69
A Fallenroot Satyr
Join Date: Feb 2013
Posts: 22
quick noob question about strings and unitID

Hey can someone answer a quick question for me, I am looking to filter the speaker in CHAT_MSG by unitID rather than semantic STRING match.

for example let's say my friend's name is Coolguy (he's in my party in the 2nd slot) and I'm listening for anything he said in chat

local f = CreateFrame("Frame")

f:RegisterEvent("CHAT_MSG_SAY")

f:SetScript("OnEvent", function(self, event, msg, sender, ...)
if (event == "CHAT_MSG_SAY" and sender == "Coolguy" ) then
print("Coolguy said something")
end
end)

that works.

but I'm wondering if I can use a unitID (party1 or player for example). in the API reference for CHAT_MSG, author is indicated as string but wondering if

if (event == "CHAT_MSG_SAY" and sender == party1 ) then

does not work/


also if someone can point me to a reference of how to check for words in a whole msg string... for example if I'm looking to flag any time someone says Blizzard in a sentence... I'm guessing I stick the thing in an array and search each element or something. but I'm a nob

thanks in advance
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » quick noob question about strings and unitID


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off