WoW:API AttackTarget: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
Line 28: Line 28:
: You can test your current attack "Action slot" using [[API_IsCurrentAction|IsCurrentAction(actionSlot)]] for status (you'll have to find the auto-attack slot, though).
: You can test your current attack "Action slot" using [[API_IsCurrentAction|IsCurrentAction(actionSlot)]] for status (you'll have to find the auto-attack slot, though).
: If you need a way to always engage auto-attack, rather than toggle it on or off, one workaround is [[API_AssistUnit|AssistUnit("player")]] this will always attack if you have "Attack on assist" checked in the Advanced tab of the Interface Options panel. Note that you cannot combine this with [[API_TargetNearestEnemy|TargetNearestEnemy()]] in the same function/macro: the "assist" target isn't updated fast enough.
: If you need a way to always engage auto-attack, rather than toggle it on or off, one workaround is [[API_AssistUnit|AssistUnit("player")]] this will always attack if you have "Attack on assist" checked in the Advanced tab of the Interface Options panel. Note that you cannot combine this with [[API_TargetNearestEnemy|TargetNearestEnemy()]] in the same function/macro: the "assist" target isn't updated fast enough.
: The macro "/startattack" will always initiate auto-attack (or auto-shot for hunters, if the appropriate interface option is active).
The text below is a few years old and is likely no longer accurate.
----
----
:The [[API_AssistUnit|AssistUnit("player")]] method described in the previous paragraph doesn't always work, in particular if you are switching between targets a lot. The most reliable way to make sure your attack is always on, no matter how many times you hit the attack button, is to use the following macro:
:The [[API_AssistUnit|AssistUnit("player")]] method described in the previous paragraph doesn't always work, in particular if you are switching between targets a lot. The most reliable way to make sure your attack is always on, no matter how many times you hit the attack button, is to use the following macro:
Anonymous user