Thread Tools Display Modes
11-27-13, 11:09 PM   #1
13ulbasaur
A Deviate Faerie Dragon
 
13ulbasaur's Avatar
Join Date: May 2013
Posts: 14
Kgpanels script for mouseover + select

Hi there!

What I'm looking for is some kind of script that will make a panel in Kgpanels visible if a frame is either has my mouse hovering over it or selected.

These are party frames, so i want this little panel to appear next to the party members when they are either selected or have my mouse hovering over them. I'm not sure how to do this. Any help?

Thanks a bunch.
  Reply With Quote
11-29-13, 10:39 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Assuming you are using the default party frames:

OnLoad
Code:
-- Change this value for each frame to match the party unit ID:
self.id = 1

-- Don't need to edit below here.
self:RegisterEvent("PLAYER_TARGET_CHANGED")

self.unit = "party"..self.id
self.frame = _G["PartyFrame"..self.id]

self.frame:HookScript("OnEnter", function()
     self:Show()
end)
self.frame:HookScript("OnLeave", function()
     if not UnitIsUnit("target", self.unit) then
          self:Hide()
     end
end)
OnEvent
Code:
self:SetShown(self:IsMouseOver() or UnitIsUnit("target", self.unit))
__________________
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.
  Reply With Quote
11-30-13, 08:16 AM   #3
13ulbasaur
A Deviate Faerie Dragon
 
13ulbasaur's Avatar
Join Date: May 2013
Posts: 14
Heya! Thanks for the reply. I'm using STUF unit frames for my party. Would that code still be applicable and if so how might I have to change it?
  Reply With Quote
11-30-13, 11:48 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You need to figure out what the names of the Stuf party frames are, and change the code accordingly. Specifically, this part:

Code:
self.frame = _G["PartyFrame"..self.id]
... will match the default UI's frame names (PartyFrame1, PartyFrame3, etc.) so if Stuf names its frames like "StufParty2" then change that line to:

Code:
self.frame = _G["StufParty"..self.id]
If you have no idea what the frames are called, type "/fstack" and move the mouse over them to find out.

You will still need to set the id appropriately (1, 2, 3, 4) for each of the 4 panels.
__________________
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.
  Reply With Quote
12-11-13, 04:26 AM   #5
13ulbasaur
A Deviate Faerie Dragon
 
13ulbasaur's Avatar
Join Date: May 2013
Posts: 14
Hi there! Sorry for the late reply, been distracted by Pokemon. Thanks so much for the help! I've put in the script and put in the name of the frame and whatnot. I haven't tested it in a real party for the select thing but I can't even get the hover over part to work, ahah.

I think I must've not edited it properly. What was I supposed to do.
Code:
-- Change this value for each frame to match the party unit ID:
self.id = 1

-- Don't need to edit below here.
self:RegisterEvent("PLAYER_TARGET_CHANGED")

self.unit = "party"..self.id
self.frame = _G["stuf.units.party"..self.id]

self.frame:HookScript("OnEnter", function()
     self:Show()
end)
self.frame:HookScript("OnLeave", function()
     if not UnitIsUnit("target", self.unit) then
          self:Hide()
     end
end)

Did I make a mistake? The unit frame name thing for the party was 'stuf.units.party1', 'stuf.units.party2' etc.etc. so I assumed I was supposed to write stuf.units.party.

Thanks so much.
  Reply With Quote
12-11-13, 04:46 AM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Code:
self.frame = _G["stuf.units.party"..self.id]
"stuf.units.party3" is not a global name. "stuf" is the global name of a table, and "units" is a key in that table, and "party3" is a key in that table, and the value stored under that key is a reference to the unit frame you want. You can't look it up the way you wrote, though. Either:

(1) Type "/fstack" and move your cursor over a party frame to find out what its name is, and change your code accordingly. For example, if the name is "stufomglolcatsandlasersharkstrexparty3", then your script needs to look up _G["stufomglolcatsandlasersharkstrexparty"..self.id]

(2) Dispense with the _G lookup and change that to stuf.units["party"..self.id] instead.
__________________
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.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Kgpanels script for mouseover + select


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