 |
| Welcome to Elitist Jerks |
We're testing some new features on the site regarding OpenID registration and coordination with gamerDNA. If you experience any issues with registering an account, please take the time to fill out a report and send it to this e-mail address. We would appreciate any assistance you could provide in making sure everything is functioning as intended. Thanks!
If this is your first visit, please be sure to check out the FAQ and the forum rules. Users must register to post and new registrations are subject to a one day "mute" period to get acquainted with the community.
|
01/27/09, 11:43 PM
|
#1
|
|
Von Kaiser
Night Elf Hunter
Icecrown
|
Simple button or icon bar sample
I'm working on a mod that will display a bar with either icons or, preferably, buttons. The highlight (border, glow, etc) will change depending on certain circumstances(1). Unfortunately, I'm far from experienced at writing Addons (I've written a couple, but always of very limited scope).
What I'm hoping for is that someone can point me at the simplest example of creating a bar of buttons/icons to be displayed on screen. The list of buttons/icons can be static, but it would be preferable if it was possible to create them dynamically.
Many thanks in advance for any suggestions.
1. Specifically, I'm trying to put together SV Hunter Priority Bar that displays the shots generally used and highlights the one that should be used next depending on what the cooldowns are on the various shots/abilities
|
|
|
|
|
|
01/28/09, 9:59 AM
|
#3
|
|
Von Kaiser
Night Elf Hunter
Icecrown
|
Originally Posted by koaschten
|
That's actually pretty close to what I'm looking for, thanks. The only differences I see are: - It doesn't look like it handles the difference between "this is ready, click it now" and "this is ready, but don't click it just yet".
- I want the icons for all the abilities to show up in fixed positions, with the one to cast next highlights. It's personal preference as I feel it will be easier to follow (for me, at least).
- Shot A is ready, but Shot B will be ready in 0.5 seconds. Shot B will be what's fired next.
I'll certainly give it a shot while I'm working on my own, though... and see if there's any code I can learn from.
Last edited by Berfert : 01/28/09 at 4:45 PM.
|
|
|
|
|
|
01/31/09, 1:29 PM
|
#4
|
|
Von Kaiser
Night Elf Hunter
Icecrown
|
More questions in pursuit of developing my AddOn...
I'm pretty sure I've figured out how to check if we're in the GCD and, if so, how long until it's over. I'm using the following code:
local function getGlobalCooldownEnds()
local spells = { "Raptor Strike", "Serpent Sting", "Mend Pet" }
local start, dur
for i,spell in pairs(spells) do
start, dur = GetSpellCooldown(GetSpellID(spell), BOOKTYPE_SPELL)
Debug("GCD: " .. spell .. " start=" .. tostring(start) .. " dur=" .. tostring(dur))
if ((start ~= nil and dur ~= nil) and (start > 0 and dur > 0 and dur <= 2)) then
return (start + dur)
end
end
return 0
end
Does that look about right?
Next, I'm trying to ask "When was the last time SpellX was cast, and how long until it's cooldown is up?". From the best I can tell, it's not actually possible to get this information. I tried using GetSpellCooldown, but that returns the same start time for every ranged spell. I suppose that makes sense, since that's how the GCD logic uses it to figure out it's information. However, I can't figure out how to get the information about a specific spell.
Anyone happen to have any thoughts?
|
|
|
|
|
|
02/05/09, 4:19 PM
|
#5
|
|
Piston Honda
|
I'm not sure why you want to know when something was last cast, in conjunction with when it comes off cooldown. As far as monitoring multiple items on cooldown, check the code for ForteXorcist.
|
|
|
|
|
|
02/06/09, 2:15 AM
|
#6
|
|
Glass Joe
|
Moved
Last edited by HereNow : 02/06/09 at 11:10 AM.
Reason: Moved this to a more relevant thread
|
|
|
|
|
|
02/06/09, 9:58 AM
|
#7
|
|
Von Kaiser
Night Elf Hunter
Icecrown
|
Originally Posted by Mugsley
I'm not sure why you want to know when something was last cast, in conjunction with when it comes off cooldown. As far as monitoring multiple items on cooldown, check the code for ForteXorcist.
|
Basically, I want to keep track of, for a set of 4 abilities, when each of them will be ready to use. The API to get the cooldown information seems to be unable to provide that information. For example, it will tell me Explosive Shot entered cooldown 1 second ago and has a 10 second re-use timer... but not that it entered cooldown due to the GCD so I can be used in 0.5 seconds.
|
|
|
|
|
|
02/06/09, 10:16 AM
|
#8
|
|
Von Kaiser
Night Elf Hunter
Icecrown
|
Originally Posted by HereNow
Not sure if that all makes sense, but at some point I will play around with a paint program and try to create an example. You could call it Spectrum or something. 
|
I'll point out that what I'm trying to make is considerably simpler than what you describe. It will display 4 buttons (ES,SS,SrS,AS) with their cooldowns if I can figure it out, and then highlight the one you should be casting next in green (or yellow if you should be casting it next but need to avoid hitting it early, such as for ES during LnL). The limitations in what I'm doing are purely due to my lack of ability writing addons (and lack of time).
I'd love to see the graphic of what you have in mind.
|
|
|
|
|
|
02/06/09, 11:05 AM
|
#9
|
|
Glass Joe
|
|
Basically, I want to keep track of, for a set of 4 abilities, when each of them will be ready to use. The API to get the cooldown information seems to be unable to provide that information. For example, it will tell me Explosive Shot entered cooldown 1 second ago and has a 10 second re-use timer... but not that it entered cooldown due to the GCD so I can be used in 0.5 seconds
|
I can see that because it has 2 states that there would be a little more to it. But can't you check to see if "Lock and Load" buff is present to determine the cooldown? As in, from your example, it is now 1 second after the spell was cast. If no buff is present then just add 5 seconds. (6 second cd) If buff is present then add 1 second. (to give the DoT time to count.)
And ya, as far as my idea goes, it should go in the "Complex button or icon bar sample" thread.  But I didnt see one, and since I've never really posted here before, didnt think I should make one, so I just kinda hijacked your thread a bit...
I just noticed though another thread that seems more applicable. Not sure if moving posts is appropriate, but I'm going to copy my above post and move it there.
|
|
|
|
|
|
02/06/09, 12:58 PM
|
#10
|
|
Von Kaiser
Night Elf Hunter
Icecrown
|
Originally Posted by HereNow
I can see that because it has 2 states that there would be a little more to it. But can't you check to see if "Lock and Load" buff is present to determine the cooldown? As in, from your example, it is now 1 second after the spell was cast. If no buff is present then just add 5 seconds. (6 second cd) If buff is present then add 1 second. (to give the DoT time to count.)
And ya, as far as my idea goes, it should go in the "Complex button or icon bar sample" thread.  But I didnt see one, and since I've never really posted here before, didnt think I should make one, so I just kinda hijacked your thread a bit...
I just noticed though another thread that seems more applicable. Not sure if moving posts is appropriate, but I'm going to copy my above post and move it there.
|
To the first point... I'm not quite sure how to handle it. Remember that you can fire ES and then proc LnL... so the proc can be up and you can still have a 6s cooldown left. As such, you definitely need to check when the shot is fired (not every .1s or such). I'm working on figuring it all out. Obviously, there's a way to figure it out since the game can set the cooldown on the buttons correctly.
As to the point of using this thread to discuss your thoughts, go for it. Honestly, I'm working on an addon to make the SV priority queue easier... and am open to any thoughts on how to do that. If I don't add them to my own addon, someone else may benefit from the knowledge.
|
|
|
|
|
|
02/07/09, 6:43 PM
|
#11
|
|
Von Kaiser
|
Edit: Deleted, I somehow missed the post where you basically used the exact same GetSpellCooldown code I was talking about.
Last edited by Vektor : 02/07/09 at 6:56 PM.
|
|
|
|
|
|
|