WoW:API AttackTarget: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m ({{wowapi}}, minor changes) |
||
Line 1: | Line 1: | ||
{{wowapi}} | |||
Toggles auto-attacking of the player's current target. | |||
AttackTarget(); | AttackTarget(); | ||
Line 22: | Line 19: | ||
;''Result'' | ;''Result'' | ||
If you were swinging your melee weapon at your target, you'll stop. If you weren't, you'll start. | |||
---- | ---- | ||
;''Description'' | ;''Description'' | ||
: | : This is actually a toggle. If not currently attacking, it will initiate attack. If currently attacking, it will stop attacking. | ||
: 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. | |||
This is actually a toggle. If not currently attacking, it will initiate attack. If currently attacking, it will stop attacking. | |||
You can test your current attack "Action slot" using | |||
Revision as of 12:28, 18 June 2006
← WoW API < AttackTarget
Toggles auto-attacking of the player's current target.
AttackTarget();
- Arguments
- none
- Returns
- nil
- Example
AttackTarget();
- Result
If you were swinging your melee weapon at your target, you'll stop. If you weren't, you'll start.
- Description
- This is actually a toggle. If not currently attacking, it will initiate attack. If currently attacking, it will stop attacking.
- You can test your current attack "Action slot" using 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 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 TargetNearestEnemy() in the same function/macro: the "assist" target isn't updated fast enough.