WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Addon stops working on combat (https://www.wowinterface.com/forums/showthread.php?t=40224)

vj44 05-21-11 04:37 PM

Addon stops working on combat
 
so, i wanted a super easy and small addon to 1. remove the Griffins from my action bars and 2. move the right actionbar, i did get this all working, only problem is, that everytime i get into combat, the bars are moved back down to the normal spot, and then once i get out of combat, addon starts working once more and moves the bars back

Code:

local f = CreateFrame("Frame")
f:SetScript("OnUpdate", function(self, e)
       
        MultiBarRight:ClearAllPoints()
        MultiBarRight:SetPoint("CENTER",1028,120)

        MainMenuBarLeftEndCap:Hide()
        MainMenuBarRightEndCap:Hide()
end)

anyone know what the problem might be?

Nibelheim 05-21-11 04:59 PM

Quote:

Originally Posted by vj44 (Post 237726)
so, i wanted a super easy and small addon to 1. remove the Griffins from my action bars and 2. move the right actionbar, i did get this all working, only problem is, that everytime i get into combat, the bars are moved back down to the normal spot, and then once i get out of combat, addon starts working once more and moves the bars back

Code:

local f = CreateFrame("Frame")
f:SetScript("OnUpdate", function(self, e)
       
        MultiBarRight:ClearAllPoints()
        MultiBarRight:SetPoint("CENTER",1028,120)

        MainMenuBarLeftEndCap:Hide()
        MainMenuBarRightEndCap:Hide()
end)

anyone know what the problem might be?

Action bars are secure frames, and thus can't be moved while in combat. Modify your addon so that you aren't moving the frames in an OnUpdate event, as well. You shouldn't need to constantly move the frames.
To know when you can move the frames, you can set up an event (PLAYER_LEAVING_COMBAT) as well as check for InCombatLockdown() being true. If necessary, watch for any other events or hook into the Blizzard functions that move the action bars back (if this happens).

Dealing with secure frames that are also controlled by Blizzard can be a little messy at times.


All times are GMT -6. The time now is 02:50 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI