WoW:Identifying buffs using textures: Difference between revisions

Typo fixing, typos fixed: occurances → occurrences using AWB
(HOWTO: Identify Buffs Using Textures)
 
(Typo fixing, typos fixed: occurances → occurrences using AWB)
Line 2: Line 2:


==Iterating buff / debuffs==
==Iterating buff / debuffs==
While we could write separate functions for buffs and debuffs, it's easier to write a single ''iterator'' function and pass the desired spell effect type as an argument - effectively cutting down the amount of code required for the whole routine. We can get the buff's texture from [[API_UnitBuff|UnitBuff]] and debuffs from [[API_UnitDebuff|UnitDebuff]]:
While we could write separate functions for buffs and debuffs, it's easier to write a single ''iterator'' function and pass the desired spell effect type as an argument - effectively cutting down the amount of code required for the whole routine. We can get the buff's texture from [[API UnitBuff|UnitBuff]] and debuffs from [[API UnitDebuff|UnitDebuff]]:
  name, rank, iconTexture, count, duration, timeLeft =  UnitBuff(unit, buffIndex [, castable]);
  name, rank, iconTexture, count, duration, timeLeft =  UnitBuff(unit, buffIndex [, castable]);
  name, rank, texture, count, debuffType, duration, timeLeft  =  UnitDebuff(unitID, debuffIndex [, removable]);
  name, rank, texture, count, debuffType, duration, timeLeft  =  UnitDebuff(unitID, debuffIndex [, removable]);
Line 56: Line 56:
  end
  end
  message("Following debuffs on unit share Spell_Fire_FireArmor texture: " .. out);
  message("Following debuffs on unit share Spell_Fire_FireArmor texture: " .. out);
Note that the last example is somewhat inefficient - you would be better off acquiring all the buff names in a single local loop rather than iterating through buffs multiple times to find all occurances of a certain texture.
Note that the last example is somewhat inefficient - you would be better off acquiring all the buff names in a single local loop rather than iterating through buffs multiple times to find all occurrences of a certain texture.


==See also==
==See also==
* [[Queriable buff effects|List of buff and debuff textures]]
* [[Queriable buff effects|List of buff and debuff textures]]


[[Category: HOWTOs|Identify Buffs Using Textures]]
[[Category:HOWTOs|Identify Buffs Using Textures]]
Anonymous user