Thread Tools Display Modes
07-30-10, 01:01 AM   #1
linguini
A Fallenroot Satyr
Join Date: Jun 2010
Posts: 20
Displaying group number when in raid on pitbull

trying to display my group number when im in a raid in lua texts!!
  Reply With Quote
07-30-10, 01:34 AM   #2
Krahg
A Deviate Faerie Dragon
 
Krahg's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 19
Arrow

Your question is a little unclear, if this doesn't cover it, could you be a bit more specific?

I looked for a pre-made API for this, but didn't find one so this should do it.

Code:
function GetSubGroupID()
	if not UnitInRaid("PLAYER") then return
	for i = 1 , GetNumRaidMembers() do
		name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i)
		if ( name == UnitName("PLAYER") ) then
			return subgroup
		end
	end
end

Last edited by Krahg : 07-30-10 at 01:40 AM.
  Reply With Quote
07-30-10, 12:19 PM   #3
linguini
A Fallenroot Satyr
Join Date: Jun 2010
Posts: 20
basically i just want to display my group number when im in a raid.
if im in group #3, it will display "3"
if im in group #4, it will display "4"
if im not in a raid group at all, it wont display anything
  Reply With Quote
08-01-10, 03:10 AM   #4
Krahg
A Deviate Faerie Dragon
 
Krahg's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 19
The function I posted should do that. Didn't it work for you? How do you want it displayed? You could try:

/run print(GetSubGroupID())
  Reply With Quote
08-01-10, 05:27 AM   #5
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
See this page for some usefull info about lua texts: http://www.wowace.com/addons/pitbull4/pages/lua-texts/

This, along with PARTY_MEMBERS_CHANGED as event might be all that is needed.
Code:
if not UnitInRaid("player") then return
local myname = UnitName('player')
for i = 1 , GetNumRaidMembers() do
	local name = GetRaidRosterInfo(i)
	if ( name == myname ) then
		return subgroup
	end
end

Last edited by ravagernl : 08-01-10 at 05:58 AM.
  Reply With Quote
08-01-10, 10:37 PM   #6
linguini
A Fallenroot Satyr
Join Date: Jun 2010
Posts: 20
WOW i completely skipped over mrruben5's post. -_-

Last edited by linguini : 08-02-10 at 05:00 PM.
  Reply With Quote
10-16-10, 08:24 AM   #7
queep
A Kobold Labourer
Join Date: Oct 2010
Posts: 1
*bump*

Does this work with pitbull 4 ? I can't find the event PARTY_MEMBER_CHANGED.
  Reply With Quote
10-16-10, 12:10 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
This thread was about PitBull4 to begin with.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
11-07-10, 08:31 AM   #9
Issa
A Kobold Labourer
Join Date: Oct 2008
Posts: 1
If you want to display the group number for every raid member, you can use this code:
Code:
if not UnitInRaid("PLAYER") then return end
for i = 1 , GetNumRaidMembers() do
    name, _, subgroup = GetRaidRosterInfo(i)
    if (name == Name(unit)) then
        return subgroup
    end
end
combined with the created event PARTY_MEMBERS_CHANGED that mrruben5 mentioned.
  Reply With Quote
06-13-11, 07:59 PM   #10
SkOODaT
A Wyrmkin Dreamwalker
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2006
Posts: 57
Code:
UpdateIn(0.25)
if not UnitInRaid("PLAYER") then return; end
    for i = 1 , GetNumRaidMembers() do
        name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i)
        if ( name == UnitName("PLAYER") ) then
            return "Group " ..subgroup
        end
end

Enjoy All
  Reply With Quote
02-04-12, 01:17 PM   #11
BromFairain
A Defias Bandit
Join Date: May 2011
Posts: 3
I was just researching this event and was glad to find this thread.
Thanks for all the code, but the Event PARTY_MEMBERS_CHANGED is not showing in the selector box.
This is in PitBull -> Layout -> Texts.
I find plenty of UNIT events in the list but not the above mentioned one. The event itself is in the LuaTexts.lua file in the PitBull4_LuaText folder.

Any pointer is appreciated
  Reply With Quote
02-06-12, 08:13 AM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You should really use the local keyword when defining variables. Otherwise you're putting crap into the global namespace with generic names like "name" and "class".

Bad:
Code:
name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i)
Good:
Code:
local name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i)
This limits those variables to the scope in which they are defined, which is the only place they are needed. It also causes them to be garbage-collected after they go out of scope, instead of lying around forever.
  Reply With Quote
02-06-12, 08:14 AM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by BromFairain View Post
... the Event PARTY_MEMBERS_CHANGED is not showing in the selector box. ...
I'm not specifically familiar with PitBull4, but if there is a limited list of events you can choose from, then you will probably need to ask the PitBull4 developers to add PARTY_MEMBERS_CHANGED to that list, or modify the addon's code to add it to the list yourself.
  Reply With Quote
09-30-12, 06:49 PM   #14
Annekynn
A Fallenroot Satyr
Join Date: Jul 2009
Posts: 21
Sorry to resurrect an old thread but this code has ceased working due to changes in 5.x , specifically this bit:

if not UnitInRaid("PLAYER") then return end
for i = 1 , GetNumRaidMembers() do
name, _, subgroup = GetRaidRosterInfo(i)
if (name == Name(unit)) then
return subgroup
end
end
Can any of you smart folks fix that so it works?
  Reply With Quote
09-30-12, 07:08 PM   #15
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
Originally Posted by Annekynn View Post
Sorry to resurrect an old thread but this code has ceased working due to changes in 5.x , specifically this bit:



Can any of you smart folks fix that so it works?
Code:
for i = 1 , GetNumGroupMembers() do
  local name, _, subgroup = GetRaidRosterInfo(i)
  if (name == Name(unit)) then
    return subgroup
  end
end
should be sufficient

Edit:
Ah, if there's any PARTY_MEMBERS_CHANGED, RAID_ROSTER_UPDATE events they should both be replaced with GROUP_ROSTER_UPDATE.
  Reply With Quote
09-30-12, 08:55 PM   #16
Annekynn
A Fallenroot Satyr
Join Date: Jul 2009
Posts: 21
Originally Posted by Dridzt View Post
Code:
for i = 1 , GetNumGroupMembers() do
  local name, _, subgroup = GetRaidRosterInfo(i)
  if (name == Name(unit)) then
    return subgroup
  end
end
should be sufficient

Edit:
Ah, if there's any PARTY_MEMBERS_CHANGED, RAID_ROSTER_UPDATE events they should both be replaced with GROUP_ROSTER_UPDATE.
The group number always says 1, even when I moved people around. I have no option for GROUP_ROSTER_UPDATE , im assuming thats why its not updating. And my original code actually looked like this to display number and name (so I just updated it to say GetNumGroupMembers as you suggested):

Code:
for i = 1, GetNumGroupMembers() do
  if UnitIsUnit("raid"..i,unit) then
    local name, rank, subgroup = GetRaidRosterInfo(i)
    if name then return "%d %s", subgroup, name end
  end
end

Last edited by Annekynn : 09-30-12 at 09:01 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Displaying group number when in raid on pitbull

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