Quantcast
KGPanel script help. Panel OnEvent of Target Target? - WoWInterface
Thread Tools Display Modes
04-04-12, 12:29 AM   #1
Zirgo
A Fallenroot Satyr
AddOn Compiler - Click to view compilations
Join Date: Nov 2007
Posts: 20
Exclamation KGPanel script help. Panel OnEvent party forms script

So I have this code that makes a panel appear when you select a target:

LASTELY... I saw this code for when a party forms:

Lua Code:
  1. In each Panel set the OnLoad script
  2.  
  3.  self:RegisterEvent("PLAYER_ENTERING_WORLD")
  4.  self:RegisterEvent("PARTY_MEMBERS_CHANGED")
  5.  self:RegisterEvent("RAID_ROSTER_UPDATE")
  6. Then in each Panel OnEvent script:
  7.  
  8.  local pmems = GetNumPartyMembers()
  9.  local rmems = GetNumRaidMembers()
  10.  if (pmems < 1 and rmems < 1) or (pmems > 0 and pmems < 6 and rmems < 6) then
  11.     self:Hide()
  12.  else
  13.     self:Show()
  14.  end

I tried putting the top part in the OnLoad and the bottom part in the OnEvent window but nothing happened :/ Does this make it so the panel only shows up when you're in a party? If so, is there a way to make it so the panel only appears when, say, there's only 2 people, or 3 people, and so forth?

Any and all help is appreciated and thank you.


__________________________________

fixed everything below this line/


EDIT: I just realized I had this problem with the IN COMBAT Script:

Lua Code:
  1. OnLoad
  2.  
  3. self:RegisterEvent("PLAYER_REGEN_DISABLED")
  4. self:RegisterEvent("PLAYER_REGEN_ENABLED")
  5. OnEvent
  6.  
  7. if event == "PLAYER_REGEN_ENABLED" then
  8.   self:Hide()
  9. elseif event == "PLAYER_REGEN_DISABLED" then
  10.   self:Show()
  11. end

It works fine after I reload UI, but every time I log in, the panel is there, even if im not in combat. After going into combat, though, it acts regularly and the panel disappears when not in combat. But only after reloading the ui or going into combat. It just bothers me logging in and having that panel active when its not supposed to.



Lua Code:
  1. OnLoad
  2.  
  3. self:RegisterEvent("UNIT_TARGET")
  4. self:Hide()
  5. OnEvent
  6.  
  7. if UnitExists("target") == nil then
  8.    self:Hide()
  9.    return
  10. end
  11. local cl = UnitClassification("target")
  12. if (cl == "elite") or (cl == "worldboss") or (cl == "rareeleite") then
  13.    self:SetBackdropColor(0.1, 0.1, 0.1, 0.1)
  14.    self:Show()
  15. else
  16.    self:SetBackdropColor(1, 1, 1, 1)
  17.    self:Show()
  18. end

Is there anyway someone could edit that for me so the panel appears ONLY when your target has a target selected?

ALSO

Is there a way to modify that code so the panel ONLY appears when you've selected a RARE mob with silver plate or an ELITE mob with golden plate?

Last edited by Zirgo : 04-04-12 at 11:00 AM. Reason: helped a bit
  Reply With Quote
04-04-12, 01:02 AM   #2
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
OnLoad
self:RegisterEvent("PLAYER_ENTERING_WORLD")

to fix your in combat script.
__________________
  Reply With Quote
04-04-12, 02:21 AM   #3
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
You can do the same check for UnitExists just use "targettarget" instead of just "target".
  Reply With Quote
04-04-12, 10:30 AM   #4
Zirgo
A Fallenroot Satyr
AddOn Compiler - Click to view compilations
Join Date: Nov 2007
Posts: 20
thank you so much, guys. that really helped!

i just need help with that party/raid forming script now.

also, is there a reason the panels take about a second delay to appear after selecting a targets target?

EDIT: I got it to work by doing:

Lua Code:
  1. OnLoad
  2.  
  3. self:RegisterEvent("PLAYER_ENTERING_WORLD")
  4. self:RegisterEvent("PARTY_MEMBERS_CHANGED")
  5.  
  6. OnEvent
  7.  
  8. local pmems = GetNumPartyMembers()
  9. local rmems = GetNumRaidMembers()
  10. if (pmems < 1) then
  11. self:Hide()
  12. elseif (pmems > 0) then
  13. self:Show()
  14. end
  15.  
  16. if (rmems > 5) then
  17. self:Hide()
  18. end

Last edited by Zirgo : 04-04-12 at 12:59 PM.
  Reply With Quote
04-04-12, 12:35 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,732
Take out all of that UnitExists and :Hide() / :Show() stuff from your combat script. Just parent the panel to the frame you want it to show with.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-04-12, 01:06 PM   #6
Zirgo
A Fallenroot Satyr
AddOn Compiler - Click to view compilations
Join Date: Nov 2007
Posts: 20
Originally Posted by Seerah View Post
Take out all of that UnitExists and :Hide() / :Show() stuff from your combat script. Just parent the panel to the frame you want it to show with.
So what exactly would the parent be? Right now its UIParent.
  Reply With Quote
04-04-12, 02:05 PM   #7
Learza
A Fallenroot Satyr
 
Learza's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 26
Type /fstack and mouse over the frames you want to parent your panels to, it'll give you the name of the frame in the tooltip that pops up, just write that instead of UIParent and /fstack again to hide the tooltip.
__________________
  Reply With Quote
04-04-12, 02:53 PM   #8
Zirgo
A Fallenroot Satyr
AddOn Compiler - Click to view compilations
Join Date: Nov 2007
Posts: 20
Originally Posted by Learza View Post
Type /fstack and mouse over the frames you want to parent your panels to, it'll give you the name of the frame in the tooltip that pops up, just write that instead of UIParent and /fstack again to hide the tooltip.
but its a combat script., the panel appears when IN combat.. what tooltip would i attach that to?
  Reply With Quote
04-04-12, 04:02 PM   #9
Learza
A Fallenroot Satyr
 
Learza's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 26
That was meant to elaborate on Seerahs post...instead of scripting the target/targettarget part you can just parent the panel to a frame and /fstack will give you the name, this should get rid of the delay. Or did I misunderstand you question?
__________________
  Reply With Quote
04-04-12, 04:28 PM   #10
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,732
I'm sorry, I mis-spoke. I meant for your third script.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-04-12, 05:27 PM   #11
Zirgo
A Fallenroot Satyr
AddOn Compiler - Click to view compilations
Join Date: Nov 2007
Posts: 20
Originally Posted by Seerah View Post
I'm sorry, I mis-spoke. I meant for your third script.
The panel is "PitBull4_Frames_targettarget" and when I put that into the Parent prompt, it gets cutt off into "PitBull4_Frames_targettarg" Because it's two letters too long.
  Reply With Quote
04-04-12, 11:11 PM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Zirgo View Post
The panel is "PitBull4_Frames_targettarget" and when I put that into the Parent prompt, it gets cutt off into "PitBull4_Frames_targettarg" Because it's two letters too long.
What happens if you put this in the panel's OnLoad script:

Code:
self:SetParent("PitBull4_Frames_targettarget")
?
  Reply With Quote
04-05-12, 08:40 PM   #13
Zirgo
A Fallenroot Satyr
AddOn Compiler - Click to view compilations
Join Date: Nov 2007
Posts: 20
Originally Posted by Phanx View Post
What happens if you put this in the panel's OnLoad script:

Code:
self:SetParent("PitBull4_Frames_targettarget")
?
thank you very much that worked
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » KGPanel script help. Panel OnEvent of Target Target?

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