Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:Making a macro
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Syntax overview== There can be an awful lot of confusion around how macro options work, so this will be an early opportunity to break down the general concepts behind them. There will be some real-world examples using actual options. Don't worry too much if you don't understand what they mean. All options will be covered in detail later on. ===General options syntax=== All slash commands basically work the same way. You have a command, and a set of parameters. The parameters depend on the command, and some commands don't take any. Here are a few examples: /cast Smite \___/ \___/ | | | parameters | command /petattack \________/ \_/ | | | parameters (empty) | command /castsequence reset=target Immolate, Corruption, Curse of Agony, Siphon Life \___________/ \____________________________________________________________/ | | command parameters Macro options allow you to choose a set of parameters based on a number of criteria. At the highest level, you have a set of criteria/parameter groups separated by semicolons. The semicolons can be seen as an "else" or an "else if." The criteria consist of zero or more sets of conditions. Each condition set is enclosed with square brackets. Here is an illustration of this basic syntax. /command [conditions] [more conditions] parameters; [conditions] parameters ... As you saw in the basic examples above, the command is evaluated from left to right. As soon as it finds a set of conditions that are true, it runs the command with the corresponding parameters. If there are no conditions in a clause, it will always be true. In fact, you can imagine a single-spell /cast command as a macro option with one clause that has no conditions. When the command does not have any conditions that are true, it will not execute at all. ===Condition syntax=== Each set of conditions is a simple comma-separated list. They can appear in any order, though [target=] is always taken into account first, before any of the conditionals. Think of the comma as an "and." A condition like [help, nodead, target=focus] means "My focus is friendly AND not dead." '''Notice:''' Conditions are case-sensitive. If you use [Help] instead of [help], the macro will generate an error. However, this does not necessarily include the condition's parameters (described below). Still, it's usually better to consistently capitalize as things appear. Write spells and items just like you see in their tooltips. Follow the examples in this guide precisely. Conditions themselves have a few building blocks. First off, as you just saw with "nodead", you can put "no" in front of a condition to mean the opposite. Notice that [nohelp] does not mean the same thing as [harm]. [harm] and [help] both return true only if there is a target to begin with. Furthermore, there are some targets that can neither be helped nor harmed (unflagged players of the other faction, non-combat pets, escort quests, etc.). Some conditions also take their own sets of parameters. For example, [stance] by itself means "In any stance" (useful for every class with stances except Warriors since they are always in a stance). However, you can also specify one or more particular stances to check. The set of parameters begins with a colon (:) and each parameter is separated with a slash (/) that means "or." Here's a generic illustration of the syntax of a single condition where everything inside angle brackets (<>) is optional. [<no>condition<:parameter</parameter</parameter<...>>>>] Here's a simple example that uses Shield Bash in Defensive or Battle Stance, but switches into Defensive Stance if you're in Berserker: /cast [stance:1/2] Shield Bash; Defensive Stance This can be simplified to pseudo-code English as "IF currently in stance 1 OR in stance 2 then use Shield Bash ELSE switch to Defensive Stance. Note: "no" applies to the whole condition and all of its parameters. This means that [nostance:1/2] would mean "anything but stances 1 or 2" ===Complete EBNF syntax=== For those who are familiar with EBNF notation, the entire macro option syntax can be represented as follows: command = "/", command-verb, [ {command-object, ";" } command-object] ] command-verb = ? any secure command word ? command-object = { condition } parameters parameters = ? anything which may be passed to the command word ? condition = "[" condition-phrase { "," condition-phrase } "]" condition-phrase = ([ "no" ], option-word, [ ":" option-argument { "/" option-argument } ] | "target=", target) option-argument = ? any one-word option, such as 'shift, 'ctrl', 'target', '1', '2' ? target = ? a target pattern ? ===Empty parameters=== One source of confusion comes in dealing with parameterless commands. A very common error when writing macros is to add an extra semicolon to the end, but this creates some unexpected bugs. Take the following macro: /petattack [@focus, harm]; To the uninitiated, that looks like it'll send your pet after your focus if it's harmful, and do nothing otherwise. However, let's look at a breakdown of this macro: /petattack [@focus, harm] ; \________/ \____________/ V V V | | | | | command options | | parameters (empty) | | | options (empty) | parameters (empty) See that extra blank set of options and parameters? Remember that a blank set of options always evaluates to true, so that second empty parameter gets passed to /petattack if the first conditions are false. === Empty conditions === Sometimes you may want a command to cast on a particular target under certain circumstances but behave like normal if those conditions aren't true. In this case you will want to use an empty set of conditions which will always evaluate to true. The following macro will cast Flash of Light on the unit under your mouse. If you have no mouseover or it's hostile, the macro will behave like a plain /cast Flash of Light, casting on your target and respecting self-cast key and auto-self-cast interface option. /cast [@mouseover, help] [ ] Flash of Light ===[target=] or [@] versus unit parameters=== Some commands accept units directly as their parameters. For example, /target party1 will target your first party member. The command /target [@party1] while a bit more verbose has the equivalent behavior. However, in most cases the designers don't want us to be able to test conditions on one unit and then act on another, so you must use one or the other. E.g., a macro like the following will not work as expected: /target [@focus, dead] party1 WoW will ignore party1 because you set a unit with the [@] targeting option. There are some specific exceptions to this rule. A few commands have "key units" that are fundamental to the command. If you use that unit in your [@] option, WoW will allow you to specify another unit or will use the default unit for the command if you don't specify one. That last bit needs a concrete example: /focus [@focus, dead] [@focus, noharm] target In this case, the key unit is focus. Since we are using [@focus], WoW will send "focus" to the /focus command. We could also have left off the "target" at the end since the /focus command defaults to your target. Below is a list of all commands with key units, and their default units if any. To reiterate for clarity, the key unit is a unit you can use in [@] option that will allow you to send another unit to the command. The Default Unit is the unit that will be sent to the command if you don't provide one. <nowiki> Command | Key Unit | Default Unit ------------- ----------- ------------- /target | target | /focus | focus | target /startattack | target | target /petattack | pettarget | target</nowiki>
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)