Originally Posted by Dagame
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)