Page 1 of 1

[Help] API UnitDebuff arguments

PostPosted: Fri Nov 13, 2015 12:11 pm
by Dreez
Hey,

does anyone have information on whether the "removable" argument of "UnitDebuff" is working correctly?

If I understood the API correctly the argument is added like this:
Code: Select all
 UnitDebuff("unit", 1,16,1)

or to make it clearer
Code: Select all
i=1,16,1 UnitDebuff("unit", i)

where the last "1" is the removable argument and 1,16 is the debuff slot range (yes, I know it should be 1,8 atm but that shouldn't matter)

However it seems to always return all debuff types, not only magic / poison but also generally unremovable debuff types like "Deserter" or "Resurrection Sickness"

macros I tested this with:

printing debuff icon information:
Code: Select all
/run for i=1,16,1 do local D= UnitDebuff("target",i); if D then ChatFrame1:AddMessage(D) end end


targeting players with debuffs
Code: Select all
/run local i=1,16,1 repeat TargetNearestFriend() until UnitDebuff("target", i) or UnitIsUnit("target", "player")==1

just added a second condition if no nearby friend has any debuff to avoid the client from crashing


is it bugged or am I just missing something?

ps: according to this http://vanilla-wow.wikia.com/wiki/API_UnitDebuff and no errors being returned the removable argument should be implemented

Re: [Help] API UnitDebuff arguments

PostPosted: Fri Nov 13, 2015 12:59 pm
by modernist
a third value in a for loop controls the method & direction of iteration & nothing else to do with the function arguments. in this case
Code: Select all
for i = 1, 16, 1 do

is exactly the same as
Code: Select all
for i = 1, 16 do


...

Code: Select all
/run for i = 1, 16 do local D= UnitDebuff("target",i, 1); if D then ChatFrame1:AddMessage(D) end end

is what you want, the third argument is essentially just a boolean on/off switch for tracking removable auras.

Re: [Help] API UnitDebuff arguments

PostPosted: Fri Nov 13, 2015 2:29 pm
by Dreez
thanks a lot!