WoW:API AttackTarget: Difference between revisions

m
Move page script moved page API AttackTarget to WoW:API AttackTarget without leaving a redirect
No edit summary
m (Move page script moved page API AttackTarget to WoW:API AttackTarget without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{wowapi}}
{{wowapi}}
{{protectedapi|2.0.1|For alternatives, try [[API_SecureTemplates|Secure Templates]].}}
Toggles auto-attacking of the player's current target.
Toggles auto-attacking of the player's current target.


Line 27: 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