How to make a cast sequence target macro?

I would like to make a macro so that when I spam it, each time I press it, it targets the next person in the list.

For instance: I have A, B, C, D, E in my macro.

I want to press the macro 5 times and target A, then, B, then, C, etc. in that order. Thanks :slight_smile:

Not possible.

I feel like you’re not understanding what I’m asking. I’m not trying to get a macro to do any of those things or make smart decisions. I just want to be able to target the people who’s names are in my macro.

Elvenbane is generally correct. Targeting is a restricted action. In a macro, only secure commands by Blizzard can target, and they’ve made no command to /targetsequence.

That said, /click is a secure command by Blizzard, and a secure button can be set up to target. But I don’t believe it’s possible to target by name in the secure environment. You can target by unit quite easily.

So if the requirement is to target people by name regardless of whether they can be referenced as a unit, then we can stop here because this functionality doesn’t exist.

If you can reference these targets as units, then you can set up a secure button to /click that can cycle through them. I have a small addon called Cycle Arena that lets you “targetsequence” through arena enemies, party members, or raid members.

And this demonstrates how to target a random person in your group that could be adapted to do it sequentially:

So as long as the criteria remains that the target is referencable by a unit, and this reference does not change during combat, then an addon could make a /targetsequence with names in a macro. The addon could add a /click to the macro (only outside of combat), and the addon could attempt to map names to units (only outside of combat), and set up a sequence (only outside of combat) to target, in combat too if it was set up beforehand out of combat.

Thanks for your thorough response. For further clarification, I want a target sequence macro for all 10 enemies in a battleground. All of these players are identifiable of course with their name and server. Would I be able to cycle through these using your addon?

Unfortunately, I don’t see any units for battleground enemies like there are for arena enemies.

What would be kind of neat is you can cycle through all battleground enemies your group is targeting, via raid1target, raid2target, etc. I’m not sure if it’d be practical since you can’t limit this by range. (Though maybe client visibility would add some range limit.)

Actually, it has occurred to me that a macrotext could be used instead of target.

This would allow true targeting by name. All opponent names could be picked up from GetBattlefieldStatData, stored in a psuedo array of attributes, and a SecureHandlerWrapScript could pick the next name and add it to a "/target " macrotext.

Oh wow that sounds interesting. Would you be willing to walk me through this? I don’t have any experience with setting up addons and I’d love to see if this would actually work.

I don’t have time to do it myself, sorry. This sort of thing requires experimentation and BGs are not a friendly place to sit in a corner and test events and API.

The basic over view if you or anyone wants to do this is:

  • Find out if UPDATE_BATTLEFIELD_SCORE updates on its own, or some other way to know opponents have changed.
  • If it doesn’t update on its own, once you leave combat (PLAYER_REGEN_ENABLED) and until you enter combat (PLAYER_REGEN_DISABLED), periodically RequestBattlefieldScoreData(). Maybe every 30 seconds. Maybe less. Many things that make requests to the server get throttled.
  • Create a frame that inherits SecureActionButtonTemplate. It needs no visible parts but it must have a name to be /clicked like TarSeq.
  • frame:SetAttribute(“type”,“macro”)
  • On UPDATE_BATTLEFIELD_SCORE or whatever triggers opponent change, out of combat populate a list of attributes on a secure frame like “TarSeq01” “TarSeq02” “TarSeq03” with names from the scoreboard. Set “TarSeqNum” to the number of targets.
  • When setting up the frame above, use SecureHandlerWrapScript to add a pre-click handler to this frame that will do an self:SetAttribute(“TarSeqIdx”,(self:GetAttribute(“TarSeqIdx”) or 0)%self:GetAttribute(“TarSeqNum”)+1). (You do this once, but need to establish how you’ll work with the list of attributes first.)
  • In the same pre-click wrap: self:SetAttribute(“macrotext”,"/target “…(self:GetAttribute(format(”%02d",self:GetAttribute(“TarSeqIdx”) or 0) + 1))
  • You may want to check if UnitExists(“target”) after this to see if it landed on someone (they could be on the other side of the map and not targetable) and try to target the next one too; but be careful to only do it TarSeqNum times or less so you don’t lock up your client.

Now /click TarSeq or whatever you name it will rotate among attempting to target opponents in a BG. It cannot take range into account.

If someone wanted to take this a step further, a /targetsequence command could be added by appending a /click to the macro. The addon Select does this to use an item/spell on flyouts defined in a macro. This would allow a macro command to /targetsequence an arbitrary list of names.

#showtooltip Renewing Mist
/cast Thunder Focus Tea
/castsequence reset=90 [@party1] Renewing Mist, [@party2] Renewing Mist, [@party3] Renewing Mist, [@party4] Renewing Mist, [@party5] Renewing Mist

this is what i use… fire and forget renewing mist. The nature of renewing mist thought likes to travel alli to alli when the target gets fully healed. This resets after 90sec, which the first one would of fell off from thunder brew tea. if your able to pump renewing mist after renewing mist out, then renewing mist should cover your party.

if you need more time on renewing mist just increase the time of Reset =90 to like reset=100 or something

You can’t use that sort of targeting with a castsequence. Options are run on the sequence as a whole not each step.