Thread Tools Display Modes
11-25-22, 04:29 PM   #1
Yakkers
A Deviate Faerie Dragon
Join Date: May 2020
Posts: 10
Looking to copy or recreate action bar slots elsewhere on the screen

I'm looking to create a very simple addon just for myself to use that will make a dummy "action bar" anchored to my personal resource display that will show a handful of select action bar buttons exactly as they appear on your hotbar - graying out when you don't have enough power, cooldown text, GCD and charge swipes, glow, etc. I've always used weakauras to do this, however you have to construct every one of those elements yourself with different triggers and conditions and it's a ton of work to account for every possible state and talent combination. It seems like it couldn't be that hard to directly copy the appearance of an action exactly as it appears on the hotbar so I figured I'd look into that instead, I don't think what I'm doing here is really what weakauras is made for anyways.

I've done a bit of simple addon creation before so I know how to do the basics and put frames onscreen and the like, but working with the API is still a bit arcane to me. I dug through the API and couldn't find anything to query the entire hotbar appearance of a given action. A more likely alternative way, is there any way I can just copy the appearance of a hotbar slot pointer-style into a custom frame?

Thanks in advance!
  Reply With Quote
11-25-22, 07:13 PM   #2
Vampyr78
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: May 2016
Posts: 10
What you are trying to achieve is very simple. You can just make Buttons that inherit from SecureActionButtonTemplate and assign it an action slot that is the same as the action slot on your actual action bar button. It's 1 for the first button on first bar 2 for the second, 13 for the first on second bar and so on. Using SacureActionButton should basicly make it behave like actionbar button and using exiting action slot should show you the exact same spell that is on the other button with the same action slot.

Code:
button = CreateFrame("CHECKBUTTON", name, parent, "SecureActionButtonTemplate, ActionBarButtonTemplate")
button:SetAttribute("type", "action")
button:SetAttribute("action", slot)
  Reply With Quote
11-25-22, 11:30 PM   #3
Yakkers
A Deviate Faerie Dragon
Join Date: May 2020
Posts: 10
Originally Posted by Vampyr78 View Post
What you are trying to achieve is very simple. You can just make Buttons that inherit from SecureActionButtonTemplate and assign it an action slot that is the same as the action slot on your actual action bar button. It's 1 for the first button on first bar 2 for the second, 13 for the first on second bar and so on. Using SacureActionButton should basicly make it behave like actionbar button and using exiting action slot should show you the exact same spell that is on the other button with the same action slot.

Code:
button = CreateFrame("CHECKBUTTON", name, parent, "SecureActionButtonTemplate, ActionBarButtonTemplate")
button:SetAttribute("type", "action")
button:SetAttribute("action", slot)
Oh wow, I can't believe it's that easy. Thanks so much.
This question is going to seem even stupider, but is there something I need to do to make child frames visible in a parent frame? My parent frame (which is going to hold all the copied hotbar icons) has bounds of 0,0,0,0 so I assume that means the parent frame is effectively invisible and that's why I'm not seeing the button child? I feel like this should be simple to find but google's algorithms are abysmal these days and I can't find the keywords it wants to show me what I need.

This is the other addon I've made, it was a simple single-frame thing so I didn't need to figure much out in this regard.
https://www.curseforge.com/wow/addons/hit-combo-popups

Edit: Got it, just needed to do Frame:SetSize(). Seems good to go now, all I need to do is figure out multi-parameter slash commands, or rather if something like /slashcommand 1 2 5 8 can be parsed as one argument that I can turn into a list of numbers.

Last edited by Yakkers : 11-26-22 at 03:34 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Looking to copy or recreate action bar slots elsewhere on the screen

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off