Thread Tools Display Modes
07-11-08, 11:27 AM   #1
Dagame
A Defias Bandit
 
Dagame's Avatar
AddOn Compiler - Click to view compilations
Join Date: Apr 2006
Posts: 3
Adding scripts to Eepanels

Hi, I've been having trouble attaching scripts to my panels. I copy and paste the code in the specific panel's script, but I always get an error. Anyone mind helping me figure out how to attach an Eepanel script like this one?

Make an eePanel show when in a raid and in a group, and hide when not:
Do not display in Battleground or Arena
Code:

-- Change our panel's visibility when in/out of a raid
function eePanels2:RaidPanelVisibility(self, event, ...)
-- If we're in a raid
if GetNumPartyMembers() > 0
and not ((select(2, IsInIstance()) == "pvp" or select(2, IsInInstance()) == "arena")
or GetNumRaidMembers() > 0
and not ((select(2, IsInIstance()) == "pvp" or select(2, IsInInstance()) == "arena")
then
-- Show the panel this script is attached to
THIS:Show()
-- If we're not in a raid
else
-- Hide the panel this script is attached to
THIS:Hide()
end
end

-- Ace2 event listeners; can't do this in more than one script
eePanels2:RegisterEvent("PLAYER_ENTERING_WORLD", eePanels2.RaidPanelVisibility)
eePanels2:RegisterEvent("PARTY_MEMBERS_CHANGED", eePanels2.RaidPanelVisibility)
eePanels2:RegisterEvent("RAID_ROSTER_UPDATE", eePanels2.RaidPanelVisibility)
  Reply With Quote
07-11-08, 11:39 AM   #2
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Originally Posted by Dagame View Post
Hi, I've been having trouble attaching scripts to my panels. I copy and paste the code in the specific panel's script, but I always get an error. Anyone mind helping me figure out how to attach an Eepanel script like this one?

Make an eePanel show when in a raid and in a group, and hide when not:
Do not display in Battleground or Arena
Code:

-- Change our panel's visibility when in/out of a raid
function eePanels2:RaidPanelVisibility(self, event, ...)
-- If we're in a raid
if GetNumPartyMembers() > 0
and not ((select(2, IsInIstance()) == "pvp" or select(2, IsInInstance()) == "arena")
or GetNumRaidMembers() > 0
and not ((select(2, IsInIstance()) == "pvp" or select(2, IsInInstance()) == "arena")
then
-- Show the panel this script is attached to
THIS:Show()
-- If we're not in a raid
else
-- Hide the panel this script is attached to
THIS:Hide()
end
end

-- Ace2 event listeners; can't do this in more than one script
eePanels2:RegisterEvent("PLAYER_ENTERING_WORLD", eePanels2.RaidPanelVisibility)
eePanels2:RegisterEvent("PARTY_MEMBERS_CHANGED", eePanels2.RaidPanelVisibility)
eePanels2:RegisterEvent("RAID_ROSTER_UPDATE", eePanels2.RaidPanelVisibility)
"THIS" needs to be replaced with "self"

also change (self, event, ...) to just (self, event)
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Adding scripts to Eepanels


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