Secure command options

From Wowpedia
Jump to: navigation, search

Some macro commands, usually those performing protected actions, can have their arguments specified using the secure command options syntax. This allows a limited range of information, expressed using macro conditionals, to be used to automate decision making. For example, you can create a macro to cast a heal if your current target is friendly, or a nuke if your current target is hostile.

Secure command options can also be used by addons, including within the RestrictedEnvironment, and by the SecureStateDriver API.

Syntax

A secure command options string consists of one or more clauses delimited by semicolons. Each clause begins with zero or more conditions (if no conditions are specified, the clause is considered to have a single, empty condition) and an optional value (any string which does not contain the []; characters). Each condition consists of zero or more macro conditionals, separated by commas, enclosed in square brackets. Conditions are considered satisfied if all of their conditionals are satisfied (and [], specifying no conditionals, is always considered satisfied). Conditions are evaluated in order, stopping at the first satisfied condition, returning the associated clause value and the conditional target (if specified by the condition). If no conditions are satisfied, no values are returned when evaluating the options string.

The interpretation of the returned clause values and condition targets depends on the context in which the secure command options are used -- different macro commands may interpret the clause values and target differently, or ignore one or both of those returns, for instance checking only that there was at least one satisfied condition.

Below are some examples of macro commands using secure command options:

  • /cast [@mouseover,harm][harm] Moonfire; [@mouseover,help][@focus,help,nodead][@player,mod:alt] Regrowth; Rejuvenation
    • There are a total of two clauses and six conditions (one of which is implicit); the first satisfied condition determines what action is performed and at which target:
      1. [@mouseover,harm]: if the mouse cursor is hovering over a hostile unit, Moonfire will be cast at that hostile unit.
      2. [harm]: if your current target is hostile, Moonfire will be cast at your target.
      3. [@mouseover,help]: if the mouse cursor is hovering over a friendly unit, Regrowth will be cast at that friendly unit.
      4. [@focus,help,nodead]: if your focus target is a friendly and still alive, Regrowth will be cast at your focus target.
      5. [@player,mod:alt]: if you are holding down the ALT key, Regrowth will be cast at your character.
      6. [] (implied by the lack of conditions in ; Rejuvenation): otherwise (always) attempt to cast Rejuvenation. The exact target depends on your current target and interface options: if you have a friendly target, Rejuvenation will be cast at it; otherwise, you may see a spell targetting cursor, or cast Rejuvenation on yourself.
  • /stopcasting [mod:alt]
    • Stops the current spell cast if you're holding down the ALT key. Otherwise, no action is performed. /stopcasting explicitly ignores the clause values and condition target.
  • /focus [@mouseover,mod:alt][]
    • Focuses the unit your mouse cursor is hovering over if ALT is being held down, and your current target otherwise.
  • /target [@focus,help][] player
    • Targets your focus target if it is friendly, and targets the player otherwise. Although the "player" value is also returned by the options string in the first case, /target ignores it in favor of the specified condition target.

See also