11-30-14, 10:20 AM | #1 |
Spiral CD on Buff Frame Issue
Hi everyone! I'm trying to add spiral cd on buff frame
But doesn't work either if i parent it to the icon or the actual buff frame.. Lua Code:
Lua Code:
|
|
11-30-14, 12:49 PM | #2 |
Before I look at anything else, please, for the love of... whatever it is you love, stop doing this:
Code:
if (_G[self..index..'Duration']) then _G[self..index..'Duration']:ClearAllPoints() _G[self..index..'Duration']:SetPoint('BOTTOM', _G[self..index], 'BOTTOM', 1, -17) _G[self..index..'Duration']:SetDrawLayer('OVERLAY') _G[self..index..'Duration']:SetFont(AftermathhUI.media.font, 13, AftermathhUI.media.fontflag) if AftermathhUI.media.shadowoffset == true then _G[self..index..'Duration']:SetShadowOffset(1, -1) _G[self..index..'Duration']:SetShadowColor(0, 0, 0) else _G[self..index..'Duration']:SetShadowOffset(0, 0) _G[self..index..'Duration']:SetShadowColor(0, 0, 0) end end Code:
local duration = _G[self..index..'Duration'] if duration then duration:ClearAllPoints() duration:SetPoint('BOTTOM', _G[self..index], 'BOTTOM', 1, -17) duration:SetDrawLayer('OVERLAY') duration:SetFont(AftermathhUI.media.font, 13, AftermathhUI.media.fontflag) if AftermathhUI.media.shadowoffset == true then duration:SetShadowOffset(1, -1) duration:SetShadowColor(0, 0, 0) else duration:SetShadowOffset(0, 0) duration:SetShadowColor(0, 0, 0) end end As for the topic problem, (1) you can't parent anything to a texture, only to a frame, and (b) can you be more specific about "doesn't work"? Do you have an error display running? Did you try adding "print" statements throughout your code to see what's happening in real-time in-game? Does anything appear in-game? If so, how is its appearance or behavior different than what you expected?
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
|
11-30-14, 01:08 PM | #3 | |
Literately nothing happens not even a error. |
||
11-30-14, 02:10 PM | #4 | |
Don't overlook this part:
Code:
hooksecurefunc('AuraButton_Update', function(self, index) print('AuraButton_Update', self, index) -- rest of the function here end) Anywhere you have significant "if" checks inside a function -- for example, if you call UnitHealth and then do an "if" check on the result -- add another print statement to show you what's being checked, eg: Code:
local hp, hpMax = UnitHealth("player"), UnitHealthMax("player") local hpPercent = hp / hpMax print("Player health:", hp, hpMax, hpPercent) if hpPercent < 0.1 then UIErrorsFrame:AddMessage("You're about to die!") end
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
||
11-30-14, 03:31 PM | #5 | |
Lua Code:
And prints just "AuraButton_Update BuffButton 123.. AuraButton_Update DebuffButton 123..." |
||
11-30-14, 03:49 PM | #6 |
Beat me, but I can't see any code to set up or start the cooldown in your example.
Like http://wowprogramming.com/docs/widge...wn/SetCooldown |
|
11-30-14, 05:22 PM | #7 | |
Lua Code:
|
||
12-01-14, 01:56 AM | #8 |
AuraButton_Update runs every time anything about the aura button is updated -- what icon it's showing, what duration to display on the text, etc. That code you just posted is creating a new cooldown object each time, so if you're getting 50 FPS, you're creating 50 cooldown objects per buff icon per second. It's also re-setting all the fonts and making all the other changes that often.
I'd suggest hooking BuffButton_OnLoad instead: Code:
hooksecurefunc("BuffButton_OnLoad", function(self) -- self is the button object, not its name. -- Use :GetName() to get the name for building the names of regions. -- Put your code here. -- Assign "self.cooldown" as a reference to the cooldown object you create. end) Code:
hooksecurefunc("AuraButton_Update", function(buttonName, index, filter) local button = _G[buttonName..index] local _, _, _, _, _, duration, expirationTime = UnitAura(PlayerFrame.unit, index, filter) if duration > 0 and expirationTime then button.cooldown:SetCooldown(expirationTime - GetTime(), duration) end end)
__________________
Retired author of too many addons. Message me if you're interested in taking over one of my addons. Don’t message me about addon bugs or programming questions. |
|
12-01-14, 04:38 PM | #9 |
Okay! Thanks i'll try get around this some way
|
|
WoWInterface » Developer Discussions » Lua/XML Help » Spiral CD on Buff Frame Issue |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|