So I've been working on an add-on that will allow me to have a sound play when a guild message comes in. I have been successful in getting the sound to play when messages come into guild chat with one problem: it also plays when I put a message in guild chat.
I need some help trying to figure out how to omit myself from it playing a sound when I put messages in.
This is for vanilla WoW 1.12.1 (not retail or classic).
Here is my code:
local CHAT_MSG_GUILD = { "" };
local CHAT_MSG_GUILDAlertFrame = CreateFrame("Frame");
local playerName = UnitName("player");
CHAT_MSG_GUILDAlertFrame:SetScript("OnEvent", function()
if arg1 ~= nil then
for i=1,table.getn(CHAT_MSG_GUILD) do
if string.find(arg1, CHAT_MSG_GUILD[i]) then
PlaySoundFile("Interface\\AddOns\\HelloWorld\\Sounds\\wisp.wav")
return;
end
end
end
end);
CHAT_MSG_GUILDAlertFrame:RegisterEvent("CHAT_MSG_GUILD");