WoW:API AttackTarget: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
m ({{wowapi}}, minor changes)
Line 1: Line 1:
<center>'''AttackTarget''' ''-Documentation by AlexanderYoshi-''</center>
{{wowapi}}
 
Toggles auto-attacking of the player's current target.
Attacks the players selected target.
 
''Note - if already attacking a target, this toggles auto-attack off --[[User:Goldark|Goldark]] 17:01, 12 Jan 2005 (EST)''


  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''


: Attacks the players selected target.
: 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 '''IsCurrentAction(actionSlot)''' for status (Attacking or Not)
 
''If you need a way to always engage auto-attack, rather than toggle it on or off, one workaround I've used is'' AssistUnit("player"); ''this will always attack if you have "Attack on assist" checked in the Advanced tab of the Interface Options panel. (Although, I should add that I've had trouble mixing this with ''TargetNearestEnemy()'' in the same macro - the "Assist" target info isn't updated fast enough I guess) -- [[User:JamesNeko|JamesNeko]] 07:03, 4 Mar 2006 (EST)''
 
----
{{Template:WoW API}}

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.