TargetRole

9k Downloads

Target by role with your own macros in just 3 steps.

Step 1. Create your macro using the keywords TANK, HEALER and/or DPS;
Step 2. Register your macro with the slash command /targetrole add myMacroName;
Step 3. Sit back and relax as TargetRole keeps your macros updated.

TargetRole stores your original macro including keywords. Each time your group changes, it auto updates your macros replacing your keywords with the appropriate unit name.

Version 1.2.9 update

Demon hunters have arrived. You can now use “DH” as a keyword .

The full list of keywords is now: LOCK, WAR, HUNTER, MAGE, PRIEST, DRUID, PALLY, SHAMAN, ROGUE, DK, MONK, DH and PET

Usage

For the basics see the TargetRole Guide page:
https://www.curseforge.com/wow/addons/targetrole/pages/main/target-role-guide

TANK, HEALER and DPS will target the first unit assigned to that role. You can also add a number to the keyword when there are multiple units with the given role.

For example: TANK2 will target the 2nd tank; DPS23 will target the 23rd dps

If no unit is found to match your keyword, the keyword is removed (replaced with nothing) which can lead to macros failing.  So in addition to using the keyword you can (and probably should) also specify a default which will be used if the given role cannot be found.
The syntax for specifying a role and default is: ROLEdefault

For readability you may also delimit defaults with a slash: ROLE/default
To further help with readability but more importantly to maintain keyword integrity (see more below) you may enclose the keyword group in angle brackets: <ROLE/default>

Consider the following:

/cast [@TANKpet] Misdirection

This will either cast  Misdirection at your current tank or if there is no tank it will cast at your pet.

/cast [@HEALERplayer] Innervate

This will either cast at your current healer or if there is no healer it will cast on yourself.  You can also use keywords as defaults and then provide another default for the second keyword:

/cast [@TANK2/TANK/pet] Misdirection

This will cast at the second tank, or if there is no second tank it will cast at the tank, or if there is no tank it will cast at your pet.  Note I've used the slash delimiters for readability.

There are no limit to how many defaults you chain together (though huge numbers may reduce performance).  Using <> to enclose your keyword group maintains keyword integrity when the next character is alphanumeric.

Consider the following:

/petattack [@TANKtarget]

Without enclosing the keyword, that will try to set your pet onto your tank or if there is no tank it will default to target.

Now with key word enclosed:

/petattack [@<TANK>target]

Now your pet will attack your tank's target or if there is no TANK your pet will attack your target.

If you don't want your macro to fail but there is no usable default, use the following method:

/cast [@<ROLE/xyz>, exists] spellname

In this case if no unit is found, the macro will attempt to find a nearby unit named xyz.  Using the parameter exists ensures the spell will not be cast unless there realy is someone named xyz hanging around.

NOTE: macros cannot be updated while in combat.  If you are in combat and the roles change you will receive a warning and macros will be updated as soon as you leave combat.

Examples

See examples and more on the macro library page:
https://www.curseforge.com/wow/addons/targetrole/pages/main/macro-library