(Author's Note: WoW 2.0 is still in Beta, and as such, these options can change at any time.)
(作者注:WoW 2.0还在Beta阶段,因此以下条件选项随时可能被更改。)
In WoW 2.0, macros and addons will drastically change. Recently, Slouken announced an exciting new addition to the functionality of macros in WoW 2.0, a set of conditional options for the /cast, /use, /target, /focus, /assist, /stopmacro, /cancelaura, /userandom, /castrandom, and /castsequence slash commands. This post is intended to be a "How-To" guide on using them.
NOTE: While most of the examples given are done using '/cast', these options are available to all the slash commands listed above.
Understand that most current macros will be obsolete in 2.0. Just about anything using CastSpellByName() or TargetUnit() will be non-functional in combat. In addition, most 'dumb logic' macros will not work either. However, you can now replicate the functionality of many popular macros with these new Macro Options.
Currently, using '/cast' is very simple. The command format is '/cast <spellname>' (which casts the highest rank of the listed spell), or '/cast <spellname>(Rank <#>)'. Some examples:
In the new system, this format still works just the same, however you can now add options to give more flexibility to your /cast statements. The new command format for '/cast' is: '/cast [<first set of options>] <first spellname>; [<second set of options>] <second spellname> ; [<third set of options>] <third spellname>; ...
The way a macro works now is like this: The first set of options is checked. If they are true, then the first spell is cast. If they are false, the next set of options is evaluated, and if true, the next spell is cast, and so on. However, you must keep in mind that only one spell will be cast. As soon as a set of options evaluates to true, the game will cast the corresponding spell, and that line of the macro will be done.
pet:<pet type OR pet name> - Evaluates 'true' if the pet exists. Takes pet type (Owl, Bear, Imp) or pet name (Fluffy, MrBigglesworth). With no modifier (i.e. just [pet]) it evaluates 'true' if ANY pet exists.
mounted, swimming, flying - Evaluates 'true' if you are mounted, swimming, or flying, respectively.
indoors, outdoors - Evaluates 'true' if you are indoors or outdoors, respectively.
button:<#> - Evaluates 'true' if the selected button was used to 'click' the spell, defaults to 1 (see below).
channeling:<spell> - Evaluates true if you are channeling the spell listed. With no spell listed, it evaluates true if any spell is being channeled.
exists and dead - Evaluates true if your target is dead, or actually exists.
新的条件选项:
pet:<pet type 或 pet name> - 检测宠物是否存在。可以接受宠物类型(枭,熊,小鬼)或者名字(Fluffy,我家坏坏)作为条件。不带条件则检测是否有任何宠物存在。
mounted,swimming,flying - 检测是否在坐骑上,游泳,或者飞行中
indoors,outdoors - 检测是在室内还是室外
button:<#> - 检测某个特定的按钮被用来触发法术,默认为1(详见下)
exists 和 dead - 检测是否目标已经死亡,或是否真的存在
New Macro Command
---------------------------
/castsequence - Casts a predetermines set of spells in sequence (See Below)
# show <spell>- Shows macro feedback for the listed spell
Some additional tricks you can do with the options:
You can add 'no' to the beginning of any option (except target) to invert it, i.e. 'nocombat' will only work if you are NOT in combat.
Seperating options with a comma ',' will act like an 'and' statement; if both options are true, it executes.
Seperating options with a slash '/' will act like an 'or' statement; if either option is true, it executes.
Selecting the '?' Icon in the Macro Editor will force the macro to present the icon of the current spell that spell feedback is being given for.
新的宏命令
---------------------------
/castsequence - 按顺序施放一组事先设定好的法术(详见下)
# show <法术> - 显示所列出法术的宏返回值
/cast Greater Heal
Very simple macro which casts Greater Heal on your target.
/cast [help] Greater Heal
One option added. Will cast Greater Heal IF the target is friendly.
/cast [help] Greater Heal; Smite
Second spell added. Since it has no option added to it, it will be cast any time the first option fails.
/cast [help, combat] Flash Heal; [help, nocombat] Greater Heal; Smite
This macro will cast Flash Heal on a friendly target if you (not the target) are in combat. If you are not in combat and the target is friendly, it will cast Greater Heal. If neither of these is true (i.e. the target is not friendly) it will cast Smite.
/cast [help] Greater Heal; [harm, combat] Smite; [harm, nocombat] Mind Flay
This will cast Greater Heal on a friendly target, or Smite if the player is in combat, or Mind Flay if the player is not in combat.
/cast [stealth] Ambush; Backstab
This will cast Ambush if the player is stealthed, Backstab if not.
/cast [nostealth] Backstab; Ambush
Does the exact same thing as above, just in a different way.
/cast [actionbar:1] Greater Heal; [actionbar:2] Smite
Will cast Greater Heal if the current actionbar is #1, Smite if it is #2, nothing if actionbars 3+ are selected
/cast [harm] Polymorph
/stopmacro [noharm]
/p Sheeping %t! DO NOT TOUCH!
This macro will cast Polymorph if the target is hostile, then stop the macro if the target is NOT hostile (i.e. if the polymorph didn't go off). Then it tells the party that it's target has been Sheeped. Note that because of the '/stopmacro' command, if the target was not sheeped, the party would not be sent a tell (thus cutting down on unneccessary spam).
/cast [pet] Call Pet; Revive Pet
This macro will call your pet if you do not have one, otherwise it attempts to cast Revive Pet.
/cast [pet:owl] Dive; [pet:cat] Dash; [pet] Growl
This macro will cast Dive if you have an owl, Dash if you have a cat, or Growl if you have anything else.
/cast [pet:Voidwalker] Sacrifice; [pet:succubus] Seduction
Will cast Sacrifice if you have a Voidwalker out, Seduction if you have a Succubus.
/use [nomounted,outdoors] Black War Steed Bridle
This will attempt to mount if you are outside and not mounted.
/cast [target=pet,dead] Revive Pet; [nopet] Call Pet; Mend Pet
This will revive your pet if it's dead, call your pet if you don't have him out, or mend your pet.
Stances work the same way. If no stance number is given, then it evaluates to 'true' if the player is in any stance. (Note that for Warriors, you are ALWAYS in some stance). If a number is given, it checks to see if that form is currently active.
Each class has different numbers for it's stances. Here is a list of stances and their numbers:
Paladin Auras are no longer treated as Stances by the Macro Option system.
Keep in mind that if you skip a stance (like a Warrior who never does the Defensive Stance quest) then your stance numbers will drop down, i.e. Berserker Stance would be stance 2.
Some stance examples.
/cast [nostance] Bear Form
If you are not in a form, this will shift you into bear form.
/cast [stance:1] Overpower; [stance:2] Sunder Armor; [stance:3] Whirlwind
Will cast Overpower in Battle stance, Sunder Armor in Defensive, and Whirlwind in Berserker stance
/cast [stance:1] Growl; [stance:3] Claw
Will cast Growl in Bear form, or Claw in Cat form.
/cast [nostance:3] Cat Form
Will put you into cat form if you are not. If you are currently in Cat form, this will NOT shift you out.
The [equipped] option also works the same way, but it's a bit trickier. The argument can be either an Inventory Slot (see below), an item type, or an item subtype. For a list of item types and subtypes, check here: http://www.wowwiki.com/ItemType
此网页不属于NGA网站,NGA不保证其安全性
继续访问 取消 不再提示我[ http://www.wowwiki.com/ItemType ]
Two-Hand 双手
Bag 包
Shirt 衬衫
Chest 胸部
Back 背部
Feet 脚
Finger 手指
Hands 手
Head 头部
Held In Off-hand 副手物品
Legs 腿部
Neck 颈部
Ranged 远程
Off Hand 副手
Shoulder 肩部
Tabard 徽章
Thrown (ranged slot items like thrown daggers) 投掷(远程槽物品例如投掷匕首)
Trinket 饰品
Waist 腰部
One-Hand 单手
Main Hand 主手
Wrist 手腕
Some equipped examples:
/cast [equipped:Two-Handed Swords] Mortal Strike; Heroic Strike
This will cast Mortal Strike if you are using a 2hand sword.
/cast [equipped:Two-Handed Swords/Two-Handed Maces/Two-Handed Axes/Polearms] Mortal Strike
This uses the '/' modifier to set up an 'or' condition. This macro will cast Mortal Strike if ANY of those types are equipped.
/cast [equipped:Shields] Shield Bash
This will cast Shield Bash if you have a shield equipped.
/cast [equipped:Shields, equipped:Daggers] Shield Slam
This will cast Shield slam only if you have a dagger AND a shield equipped.
/cast [noequipped:Shields, equipped:Off Hand] Rampage
This will cast Rampage if you do NOT have a shield equipped, AND you have something in the Off Hand slot. In theory, this macro will only activate if you are dual-wielding.
The option [button:<x>] works similarly to the modifier button. Normally, if you left-click a button, it performs whatever action is in that spell, in our case a macro. However, if you set the button option, you can change the behavior of a particular macro.
The default button is 1, the Left Mouse button. Note that when you activate a macro via a keybinding, it treats it like a Left Mouse button click. The numbered buttons are:
1 or LeftButton
2 or RightButton
3 or MiddleButton
4 or Button4
5 or Button5
... or any of the buttons remapped by the secure state headers. I don't know what this last bit means, to be honest, I'm simply quoting slouken.
lostcup: 官网UI论坛中有一篇Iriel(论坛MVP)写的SecureStateHeader Example Code,类似于一个模版,插件作者可以生成一个实例去修改默认设定。
/cast [button:2,target=player] Flash Heal; [help] Flash Heal
This macro would cast Flash Heal on a friendly target, OR if you clicked it with the right mouse button, it would cast Flash Heal on you.
The [target=unit] is a special option. Instead of evaluating to 'true' or 'false', it changes the target of the following spell AND the target of the other options. "Unit" can be any valid unit type, i.e. "player", "target", "targettarget", "party1", "party1target", etc etc. For more on unit types, go here: http://www.wowwiki.com/UnitId
此网页不属于NGA网站,NGA不保证其安全性
继续访问 取消 不再提示我[ http://www.wowwiki.com/UnitId ]
Keep in mind that every spell has a default target of "target". So, for example:
/cast [help] Greater Heal
is the same as
/cast [target=target, help] Greater Heal
Unless you add in a [target=unit] option, the default will be your current target.
Possible examples of [target=unit]:
/cast [target=player] Flash Heal
This spell will always cast flash heal on yourself. Note that your current target will be unchanged.
/cast [help] Flash Heal; [target=targettarget] Flash Heal
This will cast Flash heal on your target if it is friendly, OR it will cast Flash Heal on your target's target.
This will either 1) Cast flash heal if the target is friendly and you are in combat, 2) cast greater heal if the target is friendly and you are NOT in combat, 3) cast Flash Heal on your target's target if you are in combat and that unit is friendly, or if none of those conditions is true, it will cast Greater Heal on yourself.
If you use the unitid "none" it acts as if you had NO target. For example:
/cast [target=none] Dispel Magic
This would cast Dispel Magic and then ask for a target, regardless of whom you have targetted currently.
There's a new command in WoW 2.0, called /castsequence. It allows you to set up a series of spells to cast one after another, on each subsequent click of the macro. The format is:
It sets up a list of spells, and the first time you click the macro, it casts the first spell on the list. The next time you click it, it will cast the second spell, and so on. When it gets to the end, it goes back to the beginning.
Ok, lets say you are a mage. Sometimes you need to Frost Nova and Blink away quickly. You can't do them both at the same time, so you set up a sequence to do it!
/castsequence Frost Nova, Blink
And there you have it. The first time you click it, you Frost Nova, then you click again and Blink away.
"And what happens if Frost Nova is on cooldown? Does it Blink instead? Or does it just skip over Frost Nova and do Blink on the next click?"
Neither one. If the spell fails to cast (due to cooldown, out of range, not enough mana, whatever) then the sequence does NOT go to the next spell. The next time you click the macro, it'll try to Frost Nova again. (NOTE: A resist, dodge, parry, etc does NOT count as a failed cast. The spell/ability successfully went off, it just missed.)
"What if I'm not in combat? I don't want to waste a Frost Nova if I'm not actually fighting."
You can still use all the same macro options (however, you cannot set options for each individual spell, only for the whole sequence. Sorry.)
/castsequence [combat] Frost Nova, Blink
"Eh, I was just kidding about that combat stuff. Ok, so what happens if I Frost Nova, and decide not to Blink away? The next time I want to Frost Nova, it'll be stuck on the 'Blink' setting?"
Not a problem. We'll use the new "reset" setting. Since Frost Nova has a cooldown of 24 seconds normally, we'll set the sequence to reset after 24 seconds of non-use.
/castsequence reset=24 Frost Nova, Blink
The first time you click your macro, it will Frost Nova. If you decide not to Blink, after 24 seconds it will reset back to Frost Nova. Since Frost Nova's cooldown also happens to be 24 seconds, it'll be ready to use again. Brilliant!
"Ok, that's great and all, but I'm actually a warlock, dude."
Of course you are. Well, as a warlock, I'm sure you cast the same 3 DoTs over and over again. Now you can set a sequence for those and save button space.
/castsequence Corruption, Immolate, Curse of Agony
There you go, now you can just push that button three times and cast all three DoTs.
"But what if it dies before I finish casting all three? I'm stuck at the end of the sequence again, and I don't wanna set no timer!"
That's ok, we can use the other options. If you set 'reset=target' then any time you change targets, it will reset the sequence back to the beginning. You can also set 'reset=combat', and the game will reset your sequence any time you leave combat. If you use the '/' operator (remember it, from earlier?) you can combine reset options!
/castsequence reset=combat/target Corruption, Immolate, Curse of Agony
There, now any time you change targets (like, if the old target is almost dead and you want to start on a new one), or any time you leave combat (perhaps the critter died before you finished casting all the dots), it resets your sequence for you, leaving you ready to start over.
General Macros:
---------------
/use [target=self] Heavy Netherweave Bandages
This macro will always use Heavy Netherweave Bandages on yourself, regardless of target.
Warrior Macros:
---------------
Intercept/Charge: It either charges/intercepts, or puts you into the correct stance.
/cast [nocombat,stance:1] Charge; [combat,nostance:3] Berserker Stance; [nocombat,nostance:1] Battle Stance; [combat,stance:3] Intercept
Priest Macros
---------------
Greater Heal on current boss target, or on current target.
/cast [target=targettarget, help] Greater Heal; [help] Greater Heal
Acknowledgements
--------------------------
I'd like to take this time to give thanks to the following people:
Cogwheel, for helping collect and promote the suggestions of the UI community.
Iriel, for always helping clarify and collate information posted on the forum.
Cairenn for pushing so hard to get Mod writers into the BC Beta, and supporting them 100% with feedback and webspace.
To all the Mod Authors and Mod Websites for their wonderful and thankless work to improve the life of the other 99% of the playerbase.
And most importantly, SLOUKEN, the best dev a modding community could ever ask for. Without you, we'd be reduced to the standard interface for all eternity.