Don't play sound for my own messages.
Posted: Wed Feb 02, 2011 5:50 am
Hi guys
I have the following code in the onEvent() function of a RoM addon. It plays a sound whenever someone tries to talk to me:
The only problem is that it plays the sound whenever I post a message as well. For instance in Miller's Farm it will play the guitar.wav file everytime I cheer the chickens on.
Is there a way to check by whom the message is being posted? It might also be useful to exclude messages posted by NPCs or any users one might like to exclude for whatever reason.
All advice is appreciated in advance.
Regards
Mike
I have the following code in the onEvent() function of a RoM addon. It plays a sound whenever someone tries to talk to me:
Code: Select all
if (event == "CHAT_MSG_WHISPER") then
PlaySoundByPath("Interface/AddOns/MsgNotify/Sounds/game.wav");
end;
if (event == "CHAT_MSG_GUILD") then
PlaySoundByPath("Interface/Addons/MsgNotify/Sounds/bell.wav");
end;
if (event == "CHAT_MSG_PARTY") then
PlaySoundByPath("Interface/Addons/MsgNotify/Sounds/bell.wav");
end;
if (event == "CHAT_MSG_SAY") then
PlaySoundByPath("Interface/AddOns/MsgNotify/Sounds/guitar.wav");
end;
Is there a way to check by whom the message is being posted? It might also be useful to exclude messages posted by NPCs or any users one might like to exclude for whatever reason.
All advice is appreciated in advance.
Regards
Mike