I’m looking to change the order the buttons are arranged on Action Bar 1 via addon code.
To explain the problem, I set the bar to a 3x4 grid, and want the button order sequence to start at the top-left instead of the [default] bottom-left. To illustrate:
DEFAULT action button order (this is unable to be changed via Edit Mode):
10 11 12
7 8 9
4 5 6
1 2 3
DESIRED action button order:
1 2 3
4 5 6
7 8 9
10 11 12
DESIRED keybind layout:
1 2 3
4 5 6
7 8 9
0 - =
Yes, I can achieve the desired hotkey layout normally by remapping my keybinds, but since action button 1 is mapped to the ‘0’ key, action button 2 is ‘-’, 3 is ‘=’, 4 is ‘7’, etc., this causes a headache when going into a vehicle, where the first action button is ‘0’ instead of ‘1’ and so on.
A couple variables seem to exist in the wow lua code that are aimed at changing the button ordering to this effect. I can’t include links here for some reason, but I’m sure most addon authors will be aware of this site:
townlong-yak. com /framexml/live/ActionBar.lua
See the function starting at line 112, specifically lines 135 and 136.
Anyone know if addons can access and change action bar variables like this?
1 Like
I mean, you can do it, or you can just download Bartender 4 or ElvUI and not reinvent the wheel.
Understood. I’m trying to get away from full bar/UI addons. Just hoping to set a variable or two, until Bliz hopefully fixes this particular problem.
Ain’t likely to happen. Bar/button coding is incredibly complex and those two teams, as good as they are, had a hard time getting things to work.
Also, Blizzard is unlikely to make that change as it’s simple enough to change input devices to whatever buttons you want instead of changing the sequence of the buttons (as dumb as that sequence currently is).
I’d recommend, if you’re looking for less in an addon, that you go with Bartender 4 unless there are other aspects of the UI that you’re waiting on Blizzard to fix in which case go with ElvUI and pick up those as well.
I hear you, and thanks for your input.
To give more context for others, Bliz already seems to have coded for this functionality – they simply haven’t incorporated a front-end option to take advantage of it.
This is the portion of the ActionBar.lua code I referenced from the Bliz API:
function ActionBarMixin:UpdateGridLayout()
...
-- Multipliers determine the direction the bar grows for grid layouts
-- Positive means right/up
-- Negative means left/down
local xMultiplier = self.addButtonsToRight and 1 or -1;
local yMultiplier = self.addButtonsToTop and 1 or -1;
-- Create the grid layout according to whether we are horizontal or vertical local layout;
if self.isHorizontal then
layout = GridLayoutUtil.CreateStandardGridLayout(stride, buttonPadding, buttonPadding, xMultiplier, yMultiplier);
else
layout = GridLayoutUtil.CreateVerticalGridLayout(stride, buttonPadding, buttonPadding, xMultiplier, yMultiplier);
end
...
So to more specifically frame my original question: is there a way to set the already-existing “addButtonsToRight” and “addButtonsToTop” variables for Action Bar 1 within addon code? Anyone know?
Download Bartender 4 and look at how they do it.
Again, button code is incredibly complex and easily tainted into uselessness with the slightest error.
Several addons have already done this.
If you’re determined to do it yourself, your best source for how is going to be one of them.
Bartender 4 is the lightest-weight one I know of (which means it’ll likely be easier to find the code you want).
My guess is that it’ll look a lot like the code that Blizzard wrote - you might even be able to search for similar snippets of code to find it.
You are correct that they’ve already coded the possibility, and it would be relatively trivial for Blizzard to add this option–and one may exist but I don’t know of one. But changing that addButtonsToTop/Right will make action bars unusable in combat because that’s the very definition of intended taint behavior.
As an experiment, paste this into chat:
/run MultiBarBottomLeft.addButtonsToTop = false
Then go into Edit Mode and make Action Bar 2 two rows (or make it one and two again if it was already two). You’ll see that it grows downward now.
However, if you zone (hearthstone to garrison or use a portal someplace), you’ll likely find that using any action button that’s usable (eg. if the client thinks you can’t cast it won’t progress that far) will get a * * * ForceTaint_Strong * * * has been blocked from an action only available to the Blizzard UI. This is because an unsecure addon/script has tampered with it.
And unfortunately, even doing an execute on a frame reference in secure code will not work because the frame reference is only userdata and not any assigned properties like addButtonsToTop.
If enough people ask for the ability to reverse the direction of button growth, Blizzard may add a cvar or an option. They’ve said they want to expand the Edit Mode capabilities. This looks like an easy one.
Addons that place action buttons can do so because they do it securely. An addon can’t securely change addButtonsToTop so that option isn’t available outside Blizzard.
3 Likes
This is really helpful. Thanks for the detailed explanation. Here’s hoping Bliz takes advantage of the groundwork they already laid and provides this functionality soon.
Glad to know I’m not the only one that had this trouble
Really frustrating to have to move back to addons to get my bars to match my mouse without rebinding.