View Single Post
08-15-17, 02:08 PM   #3
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
This code looks like it was originally made when you had to query separate functions and use separate events for group sizes. Something like this would be much simpler now. I use kgpanels but without custom code, so I'm going to assume there are places to put the OnLoad and OnEvent parts and you aren't literally putting all of this into the same code box.


Lua Code:
  1. self:RegisterEvent("PLAYER_ENTERING_WORLD")
  2. self:RegisterEvent("GROUP_ROSTER_UPDATE")
The OnLoad part, which is the same for all three. PARTY_MEMBERS_CHANGED and RAID_ROSTER_UPDATE no longer exist, it is just GROUP_ROSTER_UPDATE now.


Lua Code:
  1. if GetNumGroupMembers()>20 then
  2.     self:Show()
  3. else
  4.     self:Hide()
  5. end
more than 20 players
(I'm going to assume you want something shown when there are 21 players, because the logic you wanted would show nothing when you have exactly 21 players)


Lua Code:
  1. if GetNumGroupMembers()<21 and IsInRaid() then
  2.     self:Show()
  3. else
  4.     self:Hide()
  5. end
1-20 players in a raid


Lua Code:
  1. if GetNumGroupMembers()>0 and not IsInRaid() then
  2.     self:Show()
  3. else
  4.     self:Hide()
  5. end
in a party

Last edited by Kanegasi : 08-15-17 at 02:11 PM.
  Reply With Quote