10-19-10, 11:32 AM | #1 |
[Solved] KgPanels customization [Fading and visibility]
My UI currently needs some polishing on visual panels and in this case, it's not an aesthetic problem but rather a scripting one.
Long story short, I want to adjust visibility of the panels based on conditions such as being in combat, having a target, and other such stuff as well. I don't know how much of this is doable but here's my wishlist: What I'd like to do:
I'm honestly expecting too much out of this tiny addon lol, but if I can go anywhere near what I mentioned I'd be very happy =] Last edited by Luponius : 10-23-10 at 02:25 AM. Reason: Solved =] |
|
10-19-10, 07:54 PM | #2 |
I don't think you can force the panel behavior on it's parent, it's supposed to work the other way round. And because I don't think you can change the alpha of Bartender Bars between more than two values, like say 0% and 100% you either have to be satisfied with those two or maybe take a look at this.
Not sure if you can do it that way because I never used more than 2 alpha values. If it does work with more than two alpha values you only need to get the macro conditions and it should be a solution to all your other requests. I might be wrong with the panel-parent behavior but I'm fairly certain I remember it correctly. |
|
10-19-10, 08:15 PM | #3 |
Most of that can be done with kgPanels scripting. You will need to set on:event tags in order to manipulate certain things.
BT4 does support alpha so you can fade it out at certain levels. |
|
10-19-10, 11:45 PM | #4 | |
Thanks for the replies =]
The problem I'm facing at this point is quite obvious and hard to get past, I simply have no clue of the data I need to input in onLoad and onEvent to actually gain some functionality. This is my first time looking at any sort of scripting for WoW, and although I'm not a first timer to programming, I can't quite figure out a solid resource that documents the various options we have available... If you have any idea as to what I need to type in, would appreciate it greatly |
||
10-20-10, 09:30 AM | #5 |
Honestly, WoWWiki probably has the most complete reference to the WoW API's of any website source. There is also a website on Programming for WoW, that hosts a lot of the FrameXML and Lua code provided for constants and Blizzard's UI elements. (wowprogramming.com)
between those, and the sites listed as Lua resources on WoWWiki's "Lua" page, and programming experience, you should be able to figure out what's needed.
__________________
-- Taryble |
|
10-21-10, 10:25 AM | #6 |
Been digging around for quite a while now, no results that worked, although I hope I'm picking a few good leads here... The issues I'm facing are to find the correct events that need be tested for to fire the conditions. The following is what I need, and what I found:
Checking if a target is selected Code:
UNIT_TARGET Fires when a unit's target changes PLAYER_TARGET_CHANGED Fires when the player changes targets Checking if player's in combat or not Code:
PLAYER_REGEN_DISABLED Fires when the player enters combat status PLAYER_REGEN_ENABLED Fires when the player leaves combat status Changing Color Settings: Code:
OnLoad local _, class = UnitClass("player"); if class == "WARRIOR" then self.bg:SetVertexColor(0.95, 0.23, 0.23, self.bg:GetAlpha()) I'd appreciate any help on any of the above, LUA is a first time thing for me, and researching seems to only get me so far without checking into the language itself. If nothing turns up and nobody has any idea on what I can attempt, I'll probably start looking into Pitbull4 code to see how target checks are carried out and how alpha values are set, in hopes of applying that to kgPanels. |
|
10-21-10, 11:09 AM | #7 | |
|
||
10-21-10, 03:32 PM | #8 |
Thanks on the SetAlpha() correction. So far this is where I'm at with the code:
Code:
onLoad: ------- self:RegisterEvent("PLAYER_REGEN_DISABLED") self:RegisterEvent("PLAYER_REGEN_ENABLED") self:RegisterEvent("UNIT_TARGET") onEvent: -------- if event == "PLAYER_REGEN_DISABLED" and UnitExists("target") then Self:SetAlpha(1) self:GetParent():SetAlpha(0.9) elseif event == "PLAYER_REGEN_DISABLED" then Self:SetAlpha (0.8) self:GetParent():SetAlpha(0.7) elseif event == "PLAYER_REGEN_ENABLED" and UnitExists ("target") then Self:SetAlpha (0.5) self:GetParent():SetAlpha(0.4) else Self:SetAlpha (0) self:GetParent():SetAlpha(0) Changing a frame based on Target OnLoad self:RegisterEvent("UNIT_TARGET") self:Hide() OnEvent if UnitExists("target") == nil then self:Hide() return end I guess that explains my mistake with the target checks, I assumed it automatically returns a positive if i have a target and a negative if i don't. Should of included == nil. Will try that when I can. Last edited by Luponius : 10-22-10 at 01:37 AM. |
|
10-22-10, 09:21 AM | #9 |
Tried the following with no success [Panel shows fully visible for a split second as soon as I enter combat, and disappears very quickly after that. No real clue what's gone wrong in this case, appreciate any insight.
Code:
if (event == "PLAYER_REGEN_DISABLED") and (UnitExists("target") == nil) then self:SetAlpha(0.8) self:GetParent():SetAlpha(0.7) elseif (event == "PLAYER_REGEN_DISABLED") then self:SetAlpha (1) self:GetParent():SetAlpha(0.9) elseif (event == "PLAYER_REGEN_ENABLED" and UnitExists ("target") == nil) then self:SetAlpha (0) self:GetParent():SetAlpha(0) else self:SetAlpha (0.5) self:GetParent():SetAlpha(0) end |
|
10-23-10, 02:24 AM | #10 |
Shameless triple post following, but I fixed the issue and took it a step further as well thanks to a guildie. I acquired full functionality for the action bar panel, and added fading as well. Below is the code for onLoad onEvent and onUpdate for anybody who's interested:
onLoad: Code:
self:RegisterEvent("PLAYER_REGEN_ENABLED") self:RegisterEvent("PLAYER_REGEN_DISABLED") self:RegisterEvent("UNIT_TARGET") self.inCombat = false self.fadeTo = 0 Code:
if (event == "PLAYER_REGEN_DISABLED") then self.inCombat = true elseif (event == "PLAYER_REGEN_ENABLED") then self.inCombat = false end if self.inCombat then if (UnitExists ("target") == nil) then self.fadeTo = 0.7 else self.fadeTo = 1 end else if (UnitExists ("target") == nil) then self.fadeTo = 0 else self.fadeTo = 0.5 end end Code:
local selfAlpha = self:GetParent():GetAlpha() if ( selfAlpha ~= self.fadeTo ) then if ( selfAlpha > self.fadeTo ) then if ( selfAlpha - self.fadeTo < 0.1 ) then self:GetParent():SetAlpha(self.fadeTo) else self:GetParent():SetAlpha(selfAlpha - 0.1 ) end else if ( self.fadeTo - selfAlpha < 0.1 ) then self:GetParent():SetAlpha(self.fadeTo) else self:GetParent():SetAlpha(selfAlpha + 0.1 ) end end end |
|
WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » kgpanels customization |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|