Reply
Thread Tools Display Modes
Unread 07-30-10, 01:01 AM   #1
linguini
A Deviate Faerie Dragon
Join Date: Jun 2010
Posts: 18
Displaying group number when in raid on pitbull

trying to display my group number when im in a raid in lua texts!!
linguini is offline   Reply With Quote
Unread 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.
Krahg is offline   Reply With Quote
Unread 07-30-10, 12:19 PM   #3
linguini
A Deviate Faerie Dragon
Join Date: Jun 2010
Posts: 18
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
linguini is offline   Reply With Quote
Unread 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())
Krahg is offline   Reply With Quote
Unread 08-01-10, 05:27 AM   #5
ravagernl
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,146
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.
ravagernl is offline   Reply With Quote
Unread 08-01-10, 10:37 PM   #6
linguini
A Deviate Faerie Dragon
Join Date: Jun 2010
Posts: 18
WOW i completely skipped over mrruben5's post. -_-

Last edited by linguini : 08-02-10 at 05:00 PM.
linguini is offline   Reply With Quote
Unread 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.
queep is offline   Reply With Quote
Unread 10-16-10, 12:10 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,597
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

Seerah is offline   Reply With Quote
Unread 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.
Issa is offline   Reply With Quote
Unread 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
__________________
SkOODaT is offline   Reply With Quote
Unread 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
BromFairain is offline   Reply With Quote
Unread 02-06-12, 08:13 AM   #12
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,289
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.
Phanx is offline   Reply With Quote
Unread 02-06-12, 08:14 AM   #13
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,289
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.
Phanx is offline   Reply With Quote
Unread 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?
Annekynn is offline   Reply With Quote
Unread 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,191
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.
Dridzt is offline   Reply With Quote
Unread 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.
Annekynn is offline   Reply With Quote
Reply

Go BackWoWInterface » 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