ive been searching for an example of how to do this all night but cannot seem to find anything. ive been working on a addon created by another person but they stopped updating it and i really like using it so im doing my best to make it work properly/better. its the mage recovery bar
Id like to be able to add the cooldown animation to the buttons on this addon but i have VERY limited coding knowledge. ive been trying to learn as i go. i used to be really good at mIRC scripting lol but this stuff looks alot more complicated. im sure this is possible. ive looked through the code of other action bar mods to see how/where this is done and i think ive found it in some but i dont understand how it works or how to impliment it. also the buttons on this mod change to different items depending on if your in combat or not so im guessing i would need seperate functions or somthing to properly display the cooldown animation on each item depending on your combat state.
It takes some getting used to but the cooldown spinner is just an animated model you can start at will and leave alone and it will handle spinning once and hiding itself when the cooldown is done. When you want to show the cooldown again you start another spin.
First off you need the buttons to inherit ActionButtonTemplate, or at least include the cooldown model in your frames. We'll use MultiBarBottomLeftButton12 as an example. This button is in the "bottom left" extra bar in the default UI. The cooldown model (under the <Frames> section of the template) is MultiBarBottomLeftButton12Cooldown.
You start the timer with CooldownFrame_SetTimer which takes at four arguments: frame of the cooldown model, start time, duration, enable. The latter three are exactly the results of every GetsomethingCooldown function:
frame: MultiBarBottomLeftButton12Cooldown <- change to whatever your cooldown model is
start: if there is a cooldown, this is the current GetTime(), 0 if none
duration: time (in seconds) to spin, 0 if none
enable: just needs to be over 0 to get a spinner going. Not sure why this is necessary.
Great, I was also partly looking for this, although I had gotten a fair idea of how to use the CooldownFrame_SetTimer() function earlier this was good information. My biggest issue now though is to find out what the name of the button linked to the spell/addon is.
Since I intend to implement it in an addon I'm writing, the button (a macro calling my addon to perform certain checks and thereafter maybe casting a spell) may be placed in all sorts of places, on different actionbars/flexbar/other bar addons and so forth.
Anyone have any good tips on how to fetch the button name in order to set the cooldown?