-
Posted by coder on Sun, 26 Jul 2015 17:37:11
I just started learning creating wow addons.(It's been a couple of days) I managed to learn how to listen to the event happening to me like following. How do I listen to events happening to someone else? ( friend or foe in battleground)
local f = CreateFrame("Frame") f:RegisterEvent("PLAYERREGENDISABLED") f:RegisterEvent("PLAYERTARGETCHANGED") f:RegisterEvent("PLAYERREGENENABLED")
f:SetScript("OnEvent", function(self, event,...)
if event == "PLAYER_TARGET_CHANGED" then print("you've changed your target") end if event == "PLAYER_REGEN_DISABLED" then -- enter combat print("You are in combat") elseif event == "PLAYER_REGEN_ENABLED" then -- leave combat print("You have left combat") end
end)