Thread Tools Display Modes
08-15-17, 01:24 PM   #1
Bufe
A Cyclonian
Join Date: Aug 2007
Posts: 45
Kgpanels code troubleshooting help needed.

Hello.

Hope this is the right place for it.

A few years back i wanted Kgpanels showing depending on different raid sizes.

I never really got it to work, but now i would really like to have it fixed. (i did not make this myself originally but i fiddled with it and now it don't work no more.. XD)



I get really confused with these "functions" like equal to or greater and lesser and such, so was hoping someone could look over the code, and change it so it does what i want it to do.




KGpanel #1 - 40 man raiding frame, should only show if there are more than 21 people in the raid, otherwise hide.

OnLoad:
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PARTY_MEMBERS_CHANGED")
self:RegisterEvent("RAID_ROSTER_UPDATE")

OnEvent:
local pmems = GetNumGroupMembers()

local rmems = GetNumGroupMembers()

if (pmems > 6 and rmems > 6) or (pmems > 0 and pmems > 6 and rmems > 21)
then

self:Show()

else

self:Hide()
end

KGpanel #2 - 20 man raiding frame, should only show if number of people in raid is 6-20 people.

OnLoad:
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PARTY_MEMBERS_CHANGED")
self:RegisterEvent("RAID_ROSTER_UPDATE")

OnEvent:
local pmems = GetNumGroupMembers()

local rmems = GetNumGroupMembers()


if (pmems > 6 and rmems > 6) or (pmems > 0 and pmems > 6 and rmems < 20)
then

self:Show()

else

self:Hide()
end


KGpanel #3 - 1 to 5-man, This should be visible when there are 1-5 people in a PARTY, and it is not a RAID. If it is a RAID, it should not show this, and instead show the either of the two above.

OnLoad:
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PARTY_MEMBERS_CHANGED")
self:RegisterEvent("RAID_ROSTER_UPDATE")

OnEvent:
local pmems = GetNumGroupMembers()

local rmems = GetNumGroupMembers()


if (pmems > 1 and rmems > 1) or (pmems < 5 and pmems < 5 and rmems < 5)
then

self:Show()

else

self:Hide()
end





Hope someone can help getting this right.

Thank you!



Best Regards



Boof,

Hellfire, EU

DruidPOV@T
  Reply With Quote
08-15-17, 01:59 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
The RAID_ROSTER_UPDATE event is no more, it was changed too GROUP_ROSTER_UPDATE.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
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
08-20-17, 04:42 AM   #4
Bufe
A Cyclonian
Join Date: Aug 2007
Posts: 45
Thumbs up almost there

Thank you so much for your Help Kanegasi.

Almost there.

The 1-5 player frame, i would like it to show by default, and in 5-man dungeons.
Currently it hides when i am alone, and not in a group/party/raid

...
The second thing i discovered was that when i joined LFR, it set it automatically to 40-man
When the LFR was over, it went to the <20 man mode when it was less than 20 people in the raid.

I just copy-pasted the code you gave without modifications.

Thank you so much for doing this.

EDIT: Did a world boss...and it was at like 9 people visible...then they engaged the boss so i became in combat. When combat ended it changed from 20 man raid to 40-man raid as it managed to populate +21 people.
Not sure why it did not do that in LFR.
Is LFR 25people? DOHHH..think i just answered my own question as to why it "did not work" XD...
It should not be 20..but 25 for the medium raid frames. XD 5 groups not 4!

But still...how to make 1-5 default and always show, unless the other states are active?

Maybe this???
if GetNumGroupMembers()<6 then
self:Show()
else
self:Hide()
end



Best reg.

Boof

Last edited by Bufe : 08-20-17 at 04:54 AM.
  Reply With Quote
08-20-17, 08:25 AM   #5
Bufe
A Cyclonian
Join Date: Aug 2007
Posts: 45
Works now.

https://youtu.be/5IiLNIpBLwk

Thanks!

Colours ONLY for ILLUSTRATION purposes.
That will not be my UI colors.


best reg.

Boof
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Kgpanels code troubleshooting help needed.

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