no edit summary
m ({{wowapi}}, minor changes) |
No edit summary |
||
| Line 26: | Line 26: | ||
: This is actually a toggle. If not currently attacking, it will initiate attack. If currently attacking, it will stop attacking. | : 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). | : 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")]] | : 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 [[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: | |||
/script if not IsCurrentAction(61) then UseAction(61) end; | |||
:All that one-line script does is see whether your Attack button is not enabled, and if it isn't, it turns it on. | |||
:To make this work for you: | |||
:1. drag the default Attack icon (it is button #1 on the 1st skill bar by default) to an unused slot, preferably on a skill bar you don't use much. If you want to skip step #2, simply drag the default Attack icon to button #1 of the 6th skill bar (i.e. slot 61) | |||
:2. replace the number 61 in the script with the number of that slot. The slots are numbered 1-12 for the 1st skill bar, 13-24 for the 2nd bar, and so on (25-36, 37-48, 49-60, 61-72). | |||
:3. assign the macro to a button on a skill bar (e.g. button #1 on the 1st skill bar) | |||