Quantcast
Problems with runes - WoWInterface
Thread Tools Display Modes
09-06-12, 07:35 PM   #1
Ereki
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 24
Problems with runes

Hi I made a thread about this like 2 years ago () but back then I decided to give up and just remove the problem area from the addon. And now I've decided to give it another shot but I'm not really getting any further than I did 2 years ago.

What I want to do is make a runes switch alpha depending on if they're on cooldown or not, it works well except for one thing, energize.. For those of you don't play DK a rune is energized when either Empower_Rune_Weapon, Runic_Empowerment or Blood_Tap is used. All three of those immediately refreshes a rune. To begin with here's the complete lua file of the addon http://pastebin.com/fb4G9JFV it's in a mess I know, I just can't be bothered since it works (except for this).

So the problem is that I can't get the runes to change alpha when they're energized, it works just fine every other time, I've done some digging and it appears the event RUNE_POWER_UPDATE is called twice when a rune is energized and it does some weird things.
This is when I use Blood Tap:

And this is when I use Empower Rune Weapon with every rune on CD:


The print is the following:
Code:
elseif event == "RUNE_POWER_UPDATE" and InCombatLockdown() and not UnitInVehicleControlSeat("player") then
local runeIndex, isEnergize = ...;
local runeButton = _G["RuneButtonIndividual"..runeIndex];
local start, duration, runeReady = GetRuneCooldown(runeIndex);
print(GetTime(),runeIndex,start,duration,runeReady,isEnergize)
As you can see the event is firing twice and does wierd things with isEnergize and runeReady. I've tried changing the code around (which is based on the code for energizing runes in FrameXML) right now I'm really tired and can't think straight so I figured someone here will know lua way better than me and might be able to help me.

Thanks in advance
Ereki

(And I might've done some spelling errors but it's 3:34AM here so gimmie a break :p)

Last edited by Ereki : 09-06-12 at 07:36 PM. Reason: Messed up the links
  Reply With Quote
09-06-12, 08:57 PM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,257
Nothing jumps out at me, but this block can be simplified
Code:
if not runeReady and isEnergize == nil then
	runeButton:SetAlpha(RHaoc)
else
	runeButton:SetAlpha(RHaic)
end

if isEnergize then
	runeButton:SetAlpha(RHaic)
end
to this
Code:
local alpha = (runeReady or isEnergize) and RHaic or RHaoc
runeButton:SetAlpha(alpha)
I'm not sure isEnergize means the rune is instantly ready, the default code starts a short (sub-second) energize animation, so maybe runeReady is only true at the end of that small period after energizing.
  Reply With Quote
09-07-12, 12:21 AM   #3
Barjack
A Black Drake
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 89
Just a question, but what's the significance of isEnergize in terms of functionality? I mean, why is it not sufficient to rely only on runeReady? It appears that the event with isEnergize being true is firing before a rune is technically ready (perhaps indicating that that rune is about to be "energized", for whatever reason).

But why not just treat that as a not-ready event, ignoring isEnergize, and wait until the energize is complete and the follow-up event happens a split second later, which has runeReady as true and will fix the alpha just like a normal ready event?
  Reply With Quote
09-07-12, 07:39 AM   #4
Ereki
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 24
Originally Posted by Barjack View Post
Just a question, but what's the significance of isEnergize in terms of functionality? I mean, why is it not sufficient to rely only on runeReady? It appears that the event with isEnergize being true is firing before a rune is technically ready (perhaps indicating that that rune is about to be "energized", for whatever reason).

But why not just treat that as a not-ready event, ignoring isEnergize, and wait until the energize is complete and the follow-up event happens a split second later, which has runeReady as true and will fix the alpha just like a normal ready event?
I thought of that too but I couldn't get it to work properly I tried just doing:
if not runeReady then
runeButton:SetAlpha(RHaoc)
else
runeButton:SetAlpha(RHaic)
end
But it gave pretty much the same results or completly broke the whole thing, can't really remember.. It didn't work at least
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Problems with runes

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