WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Could use a hand with custom actionbars (https://www.wowinterface.com/forums/showthread.php?t=34146)

Schnorki 07-24-10 07:23 AM

Could use a hand with custom actionbars
 
Hey there. I've come across a somewhat annoying little problem regarding the newer version of my custom-made actionbars.

1) actionbars are made from scratch, and the main bar responds to page/possession/vehicle/... changes in regards to the abilities shown
2) the default blizzard bars are removed (hidden, show function cut, all unregistered)

now, the issue is as follows:
i would like to preserve the default keybindings as the bar layout is actually the same. by default, this actually almost works, in that the bindings will generally hit the respective ability that is visible on the new actionbar (since that same ability is also what would be on the default actionbar at that point in time). the problem is however, that upon spec changing and sometimes (yes, only sometimes..odd rly) upon entering a vehicle (really only noticed it with oculus drakes actually) the bindings do not auto-update and the hotkey hence still tries to cast the respective skill occupied by that button prior to spec changing or entering a vehicle.

i figured its a fairly simple problem in that there's probably just some event registered to the default mainactionbar (onupdate would be my guess actually, since hiding alone without unregistering results in the same issues) that would normally take care of adjusting bindings to hit the new ability of reference, and that is merely no longer called due to having effectively removed the default bars.

so my question to you is, does anyone know a) what the needed function would be to update the bindings again and b) where exactly its normally called?
(i'm normally not this terrible at finding stuff myself but i've been pretty damn blind for the past couple days, lol)

contramundi 07-24-10 10:52 AM

try and poke in the core files from domino's, bartender, etc to see how they manage the action button paging/switching :)

Schnorki 07-24-10 11:03 AM

correct me if i'm wrong but last time i checked, i'm fairly certain they both came with custom keybinding, which is pretty much exactly what i'm trying to avoid as i am merely attempting to keep the default bindings working

Vrul 07-24-10 11:27 AM

The actual change of which action is associated with an action button is handled via the function ActionButton_UpdateAction. The only way for non-Blizzard code to force a call of that (without taint) is via an action button's OnAttributeChanged script. So you need to make sure that you change a button's attribute (not just set it to the same value).

Looking at your CompactBars.lua and the code directly related to this:
Code:

actionbar:SetAttribute("_onstate-page", [[
        self:SetAttribute("actionpage", tonumber(newstate));
        ActionButtons = newtable( self:GetChildren() );
        for i, button in ipairs( ActionButtons ) do
                button:SetAttribute("touch", nil);
        end
]]);
RegisterStateDriver(actionbar, "page", "[bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; [bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10; [bonusbar:5] 11; 1");
for i = 1, 12 do
        local button = CreateFrame("CheckButton", "snkUI_CompactBarButton"..i, actionbar, "ActionBarButtonTemplate");
        button:SetID(i);
        button:SetAttribute("useparent-actionpage", true);
        button:SetPoint("TOPLEFT", actionbar, 0, 0);
end

I would make the following changes:
Code:

actionbar:SetAttribute("_onstate-page", [[
        newstate = tonumber(newstate)
        for i, button in ipairs( ActionButtons ) do
                button:SetAttribute('actionpage', newstate)
        end
]]);
for i = 1, 12 do
        local button = CreateFrame("CheckButton", "snkUI_CompactBarButton"..i, actionbar, "ActionBarButtonTemplate");
        button:SetID(i);
        button:SetPoint("TOPLEFT", actionbar, 0, 0);
end
actionbar:Execute([[
        ActionButtons = newtable( self:GetChildren() );
]])
RegisterStateDriver(actionbar, "page", "[bonusbar:5] 11; [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; [bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10; 1");

Note: I changed the order of a couple things for a reason.

Schnorki 07-24-10 06:59 PM

the compact bars one is way outdated by now anyways actually

but i'll have a look and see if i can get that working with the new ones :)
thanks

Schnorki 07-25-10 08:54 AM

long story short, couldn't get it running like that because the buttons to be updated there are not the ones lacking the action-update (that would be the ones in the mainmenubar that aren't otherwise there anymore).

went with a fairly simple alternate solution (that ends up being a better route anyways rly) instead and just yanked all the bindings off of those and slapped them onto the new bars. works like a charm now. :)


All times are GMT -6. The time now is 09:53 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI