1. Need 2 indicators to show/hide the kgpanel/s if flagged or not flagged for pvp. One for player:classcolored and one for target if friendly:class colored if hostile:faction colored.
I was working on the next few a while back before taking a break from the game, I did not get them up and running and have misplaced the scripts I was working on.
1. a panel with a clock to show local time as default, on mouse over show server time.
- Ex: 1:37pm
2. a panel to show my in game mail status.
- Ex: "NO MAIL" or "NEW!"
3. a panel that will display player gold as default, on mouse over show realm total gold, all characters gold, gold loss or gain tracker.
- Ex: 2,548G 92S 34C the "G","S","C" class colored.
I know there are a ton of questions here but any help is much appreciated.
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("player"))]
self:SetBackdropColor(color.r, color.g, color.b)
self:RegisterUnitEvent("UNIT_FACTION", "player")
You may need to change the SetBackdropColor if kgPanels uses some other method.
Player PVP OnEvent:
self:SetShown(UnitIsPVP("player") or UnitIsPVPFreeForAll("player"))
if UnitExists("target") and UnitIsPlayer("target") and (UnitIsPVP("target") or UnitIsPVPFreeForAll("target")) then
local color
if UnitIsFriend("target", "player") then
color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("target"))]
else
color = FACTION_BAR_COLORS[UnitReaction("target", "player")]
end
self:SetBackdropColor(color.r or 1, color.g or 0, color.b or 0)
self:Show()
else
self:Hide()
end
self.elapsed = self.elapsed + elapsed
if elapsed >= 1 then
self.elapsed = 0
if self:IsMouseOver() then
self.Text:SetText(GameTime_GetGameTime(true))
else
self.Text:SetText(GameTime_GetLocalTime(true))
end
end
if HasNewMail() then
self.Text:SetText("YOU'VE GOT MAIL!")
else
self.Text:SetText("NO MAIL")
end
The gold panel is a bit beyond the scope of a kgPanel, as it would require saving info about each character's gold between sessions. There are plenty of gold tracking addons that will do this for you.
For both the gold and mail panels, though, I have to ask why you are using kgPanels for this instead of using DataBroker plugins which are actually designed for this kind of thing? If you're putting all the panels in a row, I highly recommend Bazooka, but ChocolateBar and DockingStation are other good bar-style DataBroker display addons. If you're placing each panel in a separate block, StatBlocksCore or Fortress are perfect for this, though Bazooka can be configured with lots of small "bars" each showing one plugin.
You are the greatest. Thanks so much :) The mail and clock code works great, thanks!
On the pvp player code I had to replace the class colors with a code you posted a while back on the forums. I also had to copy the OnEvent into the Onupdte. it works great.
local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.bg:SetVertexColor(color.r, color.g, color.b, self.bg:GetAlpha())
For the pvp target everything works except for the class color/faction color. although I did notice that on some npcs it still showed up.
I had an old UI I have been reworking and this morning before work I went to transfer some more codes and they seem to be broken.
This code was working, it would turn the created panel into a clickable button to allow you to switch between your primary/secondary spec.
OnLoad:
if (GetActiveTalentGroup() == 1) then
self.text:SetText("Primary")
else
self.text:SetText("Secondary")
end
OnClick:
if
(GetActiveTalentGroup() == 1) then SetActiveTalentGroup(2) else SetActiveTalentGroup(1)
end;
The next one was a button that I could click to toggle the LFG frame and on right click could tele in and out or leave the dungeon, it was also a mouseover:
OnLoad:
Thanks again for helping me with so much, I am just getting started and its a bits confusing. Eventually I want to code a really clean ui with an easy install. Baby steps. I know you have a lot to do so of your own any help is welcome. Thanks again!
Noooooooooooooo.... if it isn't working in the OnEvent script, that means the necessary event(s) aren't registered. Everything in the OnUpdate script gets run 30-200 times every second (if you're getting 60 FPS, it's running 60 times every second). This is very costly in terms of CPU time, obviously, so you should never use an OnUpdate script for anything that can be done by responding to events.
Can you be more specific about what is/isn't working?
There *is* a need to check the pressed argument. If you don't, then the code gets called for both pressed and released. (ie, window opens, window closes again)
I believe we've had this discussion before. kgPanels frames (while, it says OnClick, they're still just frames, iirc) can do different things on mousedown or mouseup. It's been this way for quite some time and has been documented on its main page since then. http://www.wowace.com/addons/kg-panels/
I appreciate your help and giving me tips along the way thanks :)
For the LFG panel works but when clicked does not stay open unless mouse button is held down.
The talent spec swap works perfectly as well.
So for the pvp indi on the player/target I have created two panels, one a normal black panel with a border to act as the background, the second panel is the icon to indicate the pvp flag.
The player indi is working fine, the 2 panels only appears when I am flagged for pvp and they go away when im not. The class color is a little buggy sometimes, the class color will disappear leaving the panel color to show. A /reload fixes this. Here is the code:
pvp player icon indi:
OnLoad:
local _, class = UnitClass("player")
local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
self.bg:SetVertexColor(color.r, color.g, color.b, self.bg:GetAlpha())
self:RegisterUnitEvent("UNIT_FACTION", "player")
OnEvent:
self:SetShown(UnitIsPVP("player") or UnitIsPVPFreeForAll("player"))
pvp player bg:
OnLoad:
self:RegisterUnitEvent("UNIT_FACTION", "player")
OnEvent:
self:SetShown(UnitIsPVP("player") or UnitIsPVPFreeForAll("player"))
The pvp target indi has a couple interesting things going on.
1. the class color is not working on any scenarios, it calls the panels color.
2. the black bg panel wont show on a friendly target unless target is the player.
3. the black bg panel does show on random friendly/hostile npc's where the icon does not (do those npc's have some sort of pvp flag?). I have some screenshots if it helps.
if UnitExists("target") and UnitIsPlayer("target") and (UnitIsPVP("target") or UnitIsPVPFreeForAll("target")) then
local color
if UnitIsFriend("target", "player") then
color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("target"))]
else
color = FACTION_BAR_COLORS[UnitReaction("target", "player")]
end
self:SetBackdropColor(color.r or 1, color.g or 0, color.b or 0)
self:Show()
else
self:Hide()
end
The class color is a little buggy sometimes, the class color will disappear leaving the panel color to show.
Sounds like more bad behavior on kgPanels' part, applying a default color in response to some unknown event. Try copying the coloring code from the OnLoad function into the OnEvent function as well.
Been pretty busy with work, thanks for looking at that code for me. I think I have everything working now except for the class color/faction on the target pvp indicator.
if UnitExists("target") and UnitIsPlayer("target") and (UnitIsPVP("target") or UnitIsPVPFreeForAll("target")) then
local color
if UnitIsFriend("target", "player") then
color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("target"))]
else
color = FACTION_BAR_COLORS[UnitReaction("target", "player")]
end
self:SetBackdropColor(color.r or 1, color.g or 0, color.b or 0)
self:Show()
else
self:Hide()
end
I notice that the clock script does not update without a reload, so it tells the accurate time right when you log in but then it freezes, if you have any thoughts it would be greatly appreciated.
self.elapsed = self.elapsed + elapsed
if elapsed >= 1 then
self.elapsed = 0
if self:IsMouseOver() then
self.Text:SetText(GameTime_GetGameTime(true))
else
self.Text:SetText(GameTime_GetLocalTime(true))
end
end
Sounds like kgPanels isn't running the OnUpdate script properly. Try changing this:
if elapsed >= 1 then
self.elapsed = 0
to this:
if elapsed >= 1 then
self.elapsed = 0
[B]print("Updating the clock!")[/B]
If it's printing "Updating the clock!" in your chat frame every 1 second, then the script is running, and the problem is somewhere else. If it's not printing, then kgPanels is doing something wrong, and you'll need to check your settings (do you need to enable OnUpdate scripts with a checkbox in addition to putting something in the script box?) and/or contact the author of kgPanels to figure out why it's screwing up.
Can you be more specific about the problem with the PVP panel?
I changed the script and nothing happened, when I did a /reload it printed Updating the clock! in chat but it only printed once.
About the pvp indicator for target, I wanted the icon to show if the target is flagged for pvp, if the target is self or friendly then class color and if its the opposing faction then faction colored, if not flagged for pvp then hide.
Currently the icon seems to show and hide correctly, the color is always white and does not change based on faction/class, I think its pulling the default color of the panel.
I think if it will make it easier to just have it set to do class color only, but here is the current code I have for this:
if UnitExists("target") and UnitIsPlayer("target") and (UnitIsPVP("target") or UnitIsPVPFreeForAll("target")) then
local color
if UnitIsFriend("target", "player") then
color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[select(2,UnitClass("target"))]
else
color = FACTION_BAR_COLORS[UnitReaction("target", "player")]
end
self:SetBackdropColor(color.r or 1, color.g or 0, color.b or 0)
self:Show()
else
self:Hide()
end
The pvp indicator for player and target are responding great now.
I have one remaining problem I do not believe it has to do with the script, I thought I would run it by you. If you had any thought then awesome but don't spend to much time on it, you have done plenty for me already :)
The opacity is still acting a little funny. It never looks the same it either looks like pic 1 or pic 2, I would love for it to always look like pic 1. I noticed /reload can sometimes fix this but then another reload comes from a dungeon or something and it changes again.
It looks like the texture is being drawn behind the backdrop; this can happen if both are set to draw on the same layer, because it's basically random which will actually get drawn on top. If there's a separate background color option, try fiddling with it, or setting it to fully transparent. Otherwise look for options that mention strata or layer, and increase their value.
I clean forgot about adjusting the strata. Goes to show always check the simple small things first. Everything is working perfectly, thanks again Phanx!! :)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
1. Need 2 indicators to show/hide the kgpanel/s if flagged or not flagged for pvp. One for player:classcolored and one for target if friendly:class colored if hostile:faction colored.
I was working on the next few a while back before taking a break from the game, I did not get them up and running and have misplaced the scripts I was working on.
1. a panel with a clock to show local time as default, on mouse over show server time.
- Ex: 1:37pm
2. a panel to show my in game mail status.
- Ex: "NO MAIL" or "NEW!"
3. a panel that will display player gold as default, on mouse over show realm total gold, all characters gold, gold loss or gain tracker.
- Ex: 2,548G 92S 34C the "G","S","C" class colored.
I know there are a ton of questions here but any help is much appreciated.
You may need to change the SetBackdropColor if kgPanels uses some other method.
Player PVP OnEvent:
Target PVP OnLoad:
Target PVP OnEvent:
Clock OnLoad:
Clock OnUpdate:
Mail OnLoad:
Mail OnEvent:
The gold panel is a bit beyond the scope of a kgPanel, as it would require saving info about each character's gold between sessions. There are plenty of gold tracking addons that will do this for you.
For both the gold and mail panels, though, I have to ask why you are using kgPanels for this instead of using DataBroker plugins which are actually designed for this kind of thing? If you're putting all the panels in a row, I highly recommend Bazooka, but ChocolateBar and DockingStation are other good bar-style DataBroker display addons. If you're placing each panel in a separate block, StatBlocksCore or Fortress are perfect for this, though Bazooka can be configured with lots of small "bars" each showing one plugin.
On the pvp player code I had to replace the class colors with a code you posted a while back on the forums. I also had to copy the OnEvent into the Onupdte. it works great.
For the pvp target everything works except for the class color/faction color. although I did notice that on some npcs it still showed up.
I had an old UI I have been reworking and this morning before work I went to transfer some more codes and they seem to be broken.
This code was working, it would turn the created panel into a clickable button to allow you to switch between your primary/secondary spec.
OnLoad:
OnEvent:
OnClick:
The next one was a button that I could click to toggle the LFG frame and on right click could tele in and out or leave the dungeon, it was also a mouseover:
OnLoad:
OnEnter:
OnClick:
Thanks again for helping me with so much, I am just getting started and its a bits confusing. Eventually I want to code a really clean ui with an easy install. Baby steps. I know you have a lot to do so of your own any help is welcome. Thanks again!
Noooooooooooooo.... if it isn't working in the OnEvent script, that means the necessary event(s) aren't registered. Everything in the OnUpdate script gets run 30-200 times every second (if you're getting 60 FPS, it's running 60 times every second). This is very costly in terms of CPU time, obviously, so you should never use an OnUpdate script for anything that can be done by responding to events.
Can you be more specific about what is/isn't working?
Change all instances of "GetActiveTalentGroup" to "GetActiveSpecGroup", and "SetActiveTalentGroup" to "SetActiveSpecGroup".
First, these lines in your OnLoad script are redundant and are either being overwritten by kgPanels' OnEnter/OnLeave scripts, or vice versa:
Remove those; you already have self:SetAlpha(1) in your OnEnter script, so just put this in your OnLeave script:
And change your OnClick script to just this:
(No need to check the pressed argument.)
http://www.wowace.com/addons/kg-panels/
kgPanels should stop using the wrong terminology, then.
Yes, but you have to explicitly register for *Down clicks. By default, Button objects are registered only for LeftButtonUp and RightButtonUp.
For the LFG panel works but when clicked does not stay open unless mouse button is held down.
The talent spec swap works perfectly as well.
So for the pvp indi on the player/target I have created two panels, one a normal black panel with a border to act as the background, the second panel is the icon to indicate the pvp flag.
The player indi is working fine, the 2 panels only appears when I am flagged for pvp and they go away when im not. The class color is a little buggy sometimes, the class color will disappear leaving the panel color to show. A /reload fixes this. Here is the code:
pvp player icon indi:
OnLoad:
OnEvent:
pvp player bg:
OnLoad:
OnEvent:
The pvp target indi has a couple interesting things going on.
1. the class color is not working on any scenarios, it calls the panels color.
2. the black bg panel wont show on a friendly target unless target is the player.
3. the black bg panel does show on random friendly/hostile npc's where the icon does not (do those npc's have some sort of pvp flag?). I have some screenshots if it helps.
Targeting myself
Targeting a ally player
Targeting an enemy player
Targeting an enemy npc
Here is the code:
pvp target icon indi:
OnLoad:
Onevent:
pvp target bg:
OnLoad:
OnEvent:
Thanks for your time.
Sounds like more bad behavior on kgPanels' part, applying a default color in response to some unknown event. Try copying the coloring code from the OnLoad function into the OnEvent function as well.
I'll look at your other questions tomorrow.
target pvp OnLoad:
target pvp Onevent:
I notice that the clock script does not update without a reload, so it tells the accurate time right when you log in but then it freezes, if you have any thoughts it would be greatly appreciated.
clock Onload:
clock OnUpdate:
As always thank you so much for your time.
to this:
If it's printing "Updating the clock!" in your chat frame every 1 second, then the script is running, and the problem is somewhere else. If it's not printing, then kgPanels is doing something wrong, and you'll need to check your settings (do you need to enable OnUpdate scripts with a checkbox in addition to putting something in the script box?) and/or contact the author of kgPanels to figure out why it's screwing up.
Can you be more specific about the problem with the PVP panel?
About the pvp indicator for target, I wanted the icon to show if the target is flagged for pvp, if the target is self or friendly then class color and if its the opposing faction then faction colored, if not flagged for pvp then hide.
Currently the icon seems to show and hide correctly, the color is always white and does not change based on faction/class, I think its pulling the default color of the panel.
I think if it will make it easier to just have it set to do class color only, but here is the current code I have for this:
OnLoad:
OnEvent:
Thanks so much!! :)
Also, I see the problem in the clock script now... change "if elapsed >= 1 then" to "if self.elapsed >= 1 then".
Thanks so much for sticking with me on this.
I have the clock working now yay, thanks again!!
The pvp indicator for player and target are responding great now.
I have one remaining problem I do not believe it has to do with the script, I thought I would run it by you. If you had any thought then awesome but don't spend to much time on it, you have done plenty for me already :)
The opacity is still acting a little funny. It never looks the same it either looks like pic 1 or pic 2, I would love for it to always look like pic 1. I noticed /reload can sometimes fix this but then another reload comes from a dungeon or something and it changes again.
Thanks again for everything.