View Single Post
01-10-10, 12:50 PM   #17
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Right, now you've got that part correct. Now you just need to clean up your extra function (which was probably accidentally left there).

After that, there's only one more problem with this code:

lua Code:
  1. local frame = CreateFrame("FRAME", "RFFrame");
  2. frame:RegisterEvent("UNIT_AURA");
  3. --deleted duplicate function definition that was here
  4. local active = UnitBuff('player', 'Righteous Fury')
  5. local hasrf
  6. local function eventHandler(self, event, ...)
  7.     if not hasrf and active then
  8.         hasrf = true
  9.         print('Rigtheous Fury has been activated')
  10.     elseif hasrf and not active then
  11.         hasrf = false
  12.     end
  13. end
  14. frame:SetScript("OnEvent", eventHandler);

...and that is that "active" is declared in the wrong place. You need to check whether the player has the buff every time the function runs, not just when your addon loads. Is that enough information for you to figure out what to change?
  Reply With Quote