Quantcast
WoWInterface - View Single Post - Detecting a spell sound or registering a callback on it
View Single Post
03-06-18, 12:14 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You can't detect when a specific sound is played (unless it was played by the UI code or an addon) but you can detect when a spell is cast.

Try this:
Code:
local f = CreateFrame("Frame")
f:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player")
f:SetScript("OnEvent", function(self, event, unit, spellName, _, lineID, spellID)
	if spellID == 192657 then
		DEFAULT_CHAT_FRAME:AddMessage(string.format("%s was cast!", GetSpellLink(spellID)))
	end
end)
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote