Using a value in a frame name
Hellor everyone, I'm trying to use a vaule I'm getting from an event to modify a frame name. But I don't really know how and I can't seem to find any info about it.
Code:
elseif (event == "RUNE_POWER_UPDATE" and InCombatLockdown()) and not UnitInVehicleControlSeat("player")) Thanks in advance Ereki |
_G is a table in the wow enviroment that contains EVERY global object... variables, function calls, frames, tables, everything
and because _G is a table, you can access it like _G["RuneButtonIndividual"..x]:SetAlpha() --x is a number variable :P hope that helps :) |
Cool I didn't know that, thanks a bunch!
|
Ok so I've got some more troubles and I'm turning here again since it worked out great last time.
Code:
if isEnergize == true then (The whole lua file: http://www.pastey.net/141533 I know it's messy but I got bigger issues right now :p) PS Sorry for the double post but I figured it's better than making a whole new thread |
not a problem, sorry for the delay in response as well.
you could simply try Code:
local lastAlpha = 0 so if we are running through the code lua Code:
|
That's not really my problem, I didn't explain it properly when a rune is energized RUNE_POWER_UPDATE fires twice as I said but it's only the first time isEnergized is true, the second time it's nil and it's that second that I thought put the alpha back. But I modified what you said to:
Code:
elseif event == "RUNE_POWER_UPDATE" and InCombatLockdown() and not UnitInVehicleControlSeat("player") then And I need some help in figuring out what the hell is wrong 'cause I'm out of ideas. |
I have no way to test this but you could try:
Code:
local frame = CreateFrame('Frame') |
Thanks Vrul but just gonna check somethings here, first isn't that just a replacement for the "if GetRuneCooldown(1) > 0 then" part? 'Cause that's working fine it's the energize part that's the problem (energize is when a rune is refreshed by either Runic Empowerment, Blood Tap or Empower Rune Weapon) right now the alpha stays the same and I just see the glow for it, what I want is to change the alpha to RHaic when they are energized.
And if it's working with that then i just wonder what is "OnEvent(InCombatLockdown() and 'PLAYER_REGEN_DISABLED' or 'PLAYER_REGEN_ENABLED')" is for, never seen anything like that before |
okay i tried this on live servers and i noticed something weird... RUNE_POWER_UPDATE always passes false for the 2nd arguement (which you store into isEnergized
I spammed only frost rune so I could look at it better, but when I cast Icy touch it would call the event, and when I cast it again it would call it once to try the first frost rune, and again for the 2nd one. /run test = CreateFrame("Frame") test:RegisterEvent("RUNE_POWER_UPDATE") test:SetScript("OnEvent", function(self,event,arg1,arg2) print(event,arg1,arg2 or "false") for i=5, 6 do print(GetTime(),GetRuneCooldown(i)) end end) this would output Code:
--first Icy Touch hopefully that call order will help debug on whats actually happening |
I think you're missunderstanding what isEnergized is for, isEnergized is true when a rune becomes ready throguh one of three methods: Blood Tap, Runic Empowerment or Empower Rune Weapon. So it will never be true when you just spam rune abilities, what makes it weird and hard for me to get an idea what to do is that GetRuneCooldown() still returns the cooldown the rune should've had if it was energized.
But I'm gonna do some testing with the help of that script. |
oh i see, i was testing on a level 55 dk... ive never had one before xD
well instead of lastAlpha holding a time, make it hold a rune index Code:
if isEnergize == true then also lastAlpha is being set to false... not nil if lastAlpha is nil then lastAlpha == 1 will throw an error if lastAlpha is false then lastAlpha == 1 will throw false :) |
It still doesn't change the alpha so it has to be something else that's screwing with it, this is the result I got with the script btw:
[14:52:06] RUNE_POWER_UPDATE 1 true [14:52:06] 6435.517 6426.055 10 false [14:52:06] 6435.517 6436.054 10 false [14:52:06] RUNE_POWER_UPDATE 2 false [14:52:06] 6435.518 6426.055 10 false [14:52:06] 6435.518 6436.054 10 false [14:52:06] RUNE_POWER_UPDATE 1 false [14:52:06] 6435.53 6426.055 10 false [14:52:06] 6435.531 6436.054 10 false As you can see the evenet even fires three times when using blood tap, first is the rune getting energized, second and third I have no idea why they fires. PS I edited the script to show the cooldown of rune 1 and 2 instead of 5 and 6. |
does it work when you arent trying to energize? like in a normal situation, does that addon work as intended, then the alpha comes from those cooldowns?
|
Ye the normal cooldowns work just fine, it's just the egerize part (which was introduced in 4.0.1) that's not working
|
ya know, you said the time is screwy when the energization happens, what if we see if the rune is ready
Code:
for i=1,6 do |
another thing, you said it called twice after the energization, then we cant clear the lastAlpha like that... we need to find another way to clear it, maybe
lastUpdate = 0--time lastAlpha = false -- rune then we add at the top of the elseif if lastUpdate + 2 < GetTime() then lastAlpha = false end and in the if isEnergized == true statement add a lastUpdate = GetTime() so what im envisioning is Code:
local runeIndex, isEnergize = ... |
Quote:
|
Tried that and I got the same bug as when I tried to use just _G["RuneButtonIndividual"..i] for setting the alpha when they go on cooldown which is it only fades the first rune I use and then ignores the rest and it doesn't turn the alpha up for the rune it faded once it's ready again either. When I changed it to:
Code:
local runeIndex, isEnergize = ... |
Still need help with this, does anyone have a clue what I can do?
|
look at bliz's code... i dont play a DK, but i look through the images, and they have speccial images for energized runes... see how they do it. How they make the image appear and then stay put until its used or w/e
|
All times are GMT -6. The time now is 06:35 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI