[flag]

The [flag] conditional and the /setflag command allow custom user-modifiable state to be introduced into macro command options. As an example, the following macro normally casts Battle Shout, but after being right clicked, will switch to always casting Commanding Shout:

/setflag [btn:2] command /cast [flag:command] Commanding Shout; Battle Shout

Checking flag state

The [flag] macro conditional can be used to query flag state. Flags are identified by their name, and may have an assigned value (as opposed to a binary set/cleared state).

You may use the usual /alternative syntax with this conditional:

Changing flag state

The /setflag macro command can be used to set or clear flag values. You may use extended macro options to specify the arguments to this command.

The /cycleflag macro command advances the value of a flag conditional. You may use extended macro options to specify the arguments to this command.

The /randflag macro command sets the flag to a random value within the specified range. You may use extended macro options to specify the arguments to this command.

More examples

To let right-clicking the macro toggle between casting Battle Shout and Commanding Shout, use

/setflag [btn:2,noflag:command] command; [btn:2] command= /cast [flag:command] Commanding Shout; Battle Shout

This could also be implemented using /cycleflag:

/cycleflag [btn:2] command /cast [flag:command] Commanding Shout; Battle Shout