Thread Tools Display Modes
08-30-12, 04:11 PM   #1
Shackleford
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 5
RaidIndex problem

Before the patch I used
Lua Code:
  1. for i = 1, GetNumRaidMembers() - 1 do
  2. --stuff
  3. end
to exclude the player from the lookup but now with GetNumGroupMembers() - 1 this seems to include myself (the player) in the loop. Did something change in the way the Raid Indexes are assigned?
  Reply With Quote
08-30-12, 05:13 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Function changed to GetNumGroupMembers()

A list of changes is at
http://www.wowpedia.org/Patch_5.0.1/API_changes
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
08-30-12, 05:29 PM   #3
Shackleford
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 5
I'm sorry maybe I wasn't clear enough in my post. Simply subbing GetNumGroupMembers() for GetNumRaidMembers() isn't my issue, its the problem of the player (myself) being indexed. Before the patch it would properly exclude the player and now it seems that GetNumGroupMembers() - 1 still includes the player. Which I'm wondering if the player isn't always the last Raid Index now.
  Reply With Quote
08-30-12, 05:40 PM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Can't test now but about the indexes but maybe the simplest workaround is to check with
Code:
not UnitIsUnit("player", raidunit)
and skip player that way.
  Reply With Quote
08-30-12, 05:41 PM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
It just returns a number 0 to 40. just like GetNumRaidMembers()

I would think you would need to check if one of the units in that number is you (player). In other words, it's the stuff you need to fix not the actual counter.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
08-30-12, 07:45 PM   #6
Shackleford
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 5
Originally Posted by Dridzt View Post
Can't test now but about the indexes but maybe the simplest workaround is to check with
Code:
not UnitIsUnit("player", raidunit)
and skip player that way.
Was able to hop into a raid tonight and check, I was indexed at 24 instead of 25. I don't know if that's how it will always return or if you get a different index every time or if its a bug, but I wasn't last. I implemented this and it seems to work fine now. Thanks.
  Reply With Quote
08-31-12, 03:55 AM   #7
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
I have no idea really, but maybe the raid leader gets the last index?
__________________
Grab your sword and fight the Horde!
  Reply With Quote
08-31-12, 08:53 AM   #8
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
The unit index is different between clients, and I'm not sure why. You might be raid20 on your machine, but someone else will see yet another person at raid20 on their machine, even if you are both in the same raid.

We noticed that when the raid leader was master looting. Rolling random 25, if he got himself, he would ask us, and we would say no, it is actually BobTheTank.

If I understand you correctly, you are building a table of raid members, and do not want to include yourself?
Lua Code:
  1. local raidMembers = {}
  2. for i = 1, GetNumGroupMembers() do
  3.     -- we want to add everybody BUT the player
  4.     local raider = UnitName(i)
  5.     if not UnitIsUnit("player", raider) then
  6.         table.insert(raidMembers, raider)
  7.     end
  8. end
  Reply With Quote
08-31-12, 09:00 AM   #9
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
If you want the raidID, and not the unit's name, change line 7 to
Lua Code:
  1. table.insert(raidMembers, raid .. i)
  Reply With Quote
08-31-12, 07:48 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by myrroddin View Post
The unit index is different between clients, and I'm not sure why. You might be raid20 on your machine, but someone else will see yet another person at raid20 on their machine, even if you are both in the same raid.

We noticed that when the raid leader was master looting. Rolling random 25, if he got himself, he would ask us, and we would say no, it is actually BobTheTank.
Yes, that's why the whole "/random 1-25" method of loot distribution is a scam. There's simply no way to verify which raid index someone has in another player's client. Even if the person running the scam thinks they're doing it fairly, it's still unverifiable, and thus should always be viewed as a scam and not allowed.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-01-12, 03:20 AM   #11
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Originally Posted by Phanx View Post
Yes, that's why the whole "/random 1-25" method of loot distribution is a scam. There's simply no way to verify which raid index someone has in another player's client. Even if the person running the scam thinks they're doing it fairly, it's still unverifiable, and thus should always be viewed as a scam and not allowed.
True, and just to add to the madness: when the raid leader asked us to verify the raid member, everybody BUT him showed the same people in the same order on their machines. The weirdness only affected Master Looters and/or Raid Leaders.

In other words, "Myrroddin" was the same raid position on my machine, Jixx's, Felong's, etc, but not on Lorne's because he was the RL/ML. I can't verify the raidID was the same, however.

In any case, I'm surprised GetNumRaidMembers() -1 even worked in the first place...

Last edited by myrroddin : 09-01-12 at 03:26 AM. Reason: clarification
  Reply With Quote
09-01-12, 05:30 AM   #12
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by myrroddin View Post
In any case, I'm surprised GetNumRaidMembers() -1 even worked in the first place...
Your own character used to always be the highest raid index, eg UnitIsUnit("player", "raid"..GetNumRaidMembers()), and I believe this no longer being the case is the reason for this thread being created.

Btw, maybe your raid leader simply used a different addon? Addons can sort the raid roster in a few different ways.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
09-01-12, 05:58 PM   #13
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
I'd answer that Lombra, but that is getting way off the original topic. What I want to know is if Shackleford got his code fixed or not.
  Reply With Quote
09-01-12, 07:00 PM   #14
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Lombra View Post
Addons can sort the raid roster in a few different ways.
Addons can change the order in which raid members are displayed, but they cannot change which unitID is assigned to which raid member; that's handled by the game client and/or server, and cannot be altered by addons.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
09-01-12, 07:47 PM   #15
Shackleford
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 5
Got in another raid tonight and ran this macro as people came and gone,

Code:
/script local index = UnitInRaid("target"); if index then DEFAULT_CHAT_FRAME:AddMessage(index) end
It seems again if there were more than 20 people in the group I was indexed next to last eg. (23 out of 24 or 24 out of 25) but when there were less than 20 people I was indexed last. Checked raid leader and assistants and RL was 1 and assistants 2 and 3.

Anyways by adding the not UnitIsUnit("player", "raid"..i) check in my code it solved my problem.

Last edited by Shackleford : 09-01-12 at 07:49 PM.
  Reply With Quote
09-02-12, 05:52 AM   #16
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Originally Posted by Shackleford View Post
Anyways by adding the not UnitIsUnit("player", "raid"..i) check in my code it solved my problem.
Glad to hear it!
  Reply With Quote
09-08-12, 05:36 AM   #17
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by Phanx View Post
Addons can change the order in which raid members are displayed, but they cannot change which unitID is assigned to which raid member; that's handled by the game client and/or server, and cannot be altered by addons.
Indeed. I'm assuming this raid leader just looked at their raid frames though, not checked the result of UnitName("raidN").
__________________
Grab your sword and fight the Horde!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » RaidIndex problem


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