User:Enalung/Custumise Druid Macros

Disclaimer
This page does not aim at teaching you everything you need to know about macros. It is specificaly aimed at custumising the macros present on the Useful_macros_for_druids page. It assumes you have basic knowledge of how to make macros. To learn how to make your own macros, please refer to the section.

Coding Basics
Although you might not think of it, the code which makes a macro within world of warcraft is a form of programming. As with any programming, there are a few basic conventions which should be respected in order to yield the desired results. This section aims at teaching you the basics without going into too many details.

Negations
Wrong

/cast [noswimming] !Travel Form; !Aquatic Form

Correct

/cast [swimming] !Aquatic Form; !Travel Form

Both will work, but as your macros get more complex, it will make them harder to read. It is best to state things directly and avoid negations whenever possible.

Extraneous Conditions
Wrong

/cast [swimming] !Aquatic Form; [noswimming] !Travel Form

Correct

/cast [swimming] !Aquatic Form; !Travel Form

While both will work, the noswimming condition is not required. When the first condition is interpreted, if swimming checks to false, then we aready know that we are not swimming. Using a noswimming condition is equivalent to testing weather true = true which we know will always equal to true.

Condition and Spell Order
Wrong

/cast [noswimming, nocombat, noindoors] !Swift Flight Form; [noswimming; noindoors] !Travel Form; [noswimming] !Aquatic Form; !Travel Form;

Correct

/cast [swimming] !Aquatic Form; [indoors] !Cat Form; [combat][noflyable] !Travel Form; !Swift Flight Form

Notice how heavy the first version is compared to the second version. While both versions will work, the second is easier to read, modify and will also require less processor time to execute. This exemple also has several extraneous conditions and also suffers from abusive use of negations. We check 3 times that we aren't swimming. Such occurances are usualy a sign that the spell cast order and condition order should be reviewed.

There is no set rules as to the order in which conditions and spells should be ordered. The general rule should be that you want your last spell to be the default. Your first spell is determined by your conditions. Your first spell should fit a general condition while each spell down line should fit a more and more specific conditions which is defined by the accumunlation of conditions which tested false.

Notice how Aquatic Form went from the tail end to the start of the macro. We check to see if we are swimming once, and then we know for the rest of the macro that we aren't swimming. Then we check to see if we are indoors and we know for the rest of the macro that we are not indoors. By the time we get to Swift Flight Form, we know that we aren't swimming, aren't indoors, aren't in combat and can fly. It dosen't get much more specific then that!

General Custumisation
How to remove audible error messages such as "Target not in Range"? You can either turn off Error Speech in your Sound & Voice settings, or add the following lines at the beginning and end of the offending macro.

/console Sound_EnableSFX 0 /console Sound_EnableSFX 1

How do I activate a trinket, or any other item? Add theses lines at the end of your macro to activate a trinket. 13 is the top trinket slot, 14 is the bottom slots. For any other equipment or inventory slot, refer to InventorySlotId

/use 13 /use 14

How do I set a raid target? The following command will set a skull raid target.

/script SetRaidTarget("target",8)

Notes


 * The number 8 in this line refers to the skull. Refer to Raid_target_icons for the ID of other raid targets.
 * Target can be replaced with any valid unit ID. Refer to UnitId for other valid unit IDs.

How do I swap action bars? Nowadays, most action bar mods allow very fine control of action bar paging. However, some might still wish to page bars using macros. Should this be your case, this line will allow you to do that. Change the numbers to the bars you wish to swap.

/swapactionbar 1 2

Shapeshift & Travel
You may have noticed that most of the macros in the Shapeshift and Travel section all have the same general syntaxic construction. There is no accident to this, they were all adapted from the same basic code. This section aims at explaining the logic behind that code and how to modify it to your likes.

Travel Syntax
/cancelform [nostance:0,mod:shift] /stopmacro [mod:shift] /cast [swimming] !Aquatic Form; [indoors] !Cat Form; [combat][mod:CTRL] !Travel Form; [flyable] !Swift Flight Form; Ground Mount /dismount [mounted]
 * 1) showtooltip


 * Line 1: Shows the tooltip when you mouseover the button and hides the macro text.
 * Line 2: Cancels any form you are in when shift is pressed.
 * Line 3: Stops the macro when shift is pressed. We do this in order to avoid having to add nomod:shift to every single condition after this line.
 * Line 4: This is the actual cast line...
 * We test to see if we are swimming first because it is the only in water travel mode we will want to use.
 * We test to see if we are indoors. Both Travel Form and Swift Flight Form can only be used while Outdoors, so we save ourselves 2 conditions.
 * We test to see if we are in combat. While Travel Form is usable in combat, Swift Flight Form is not. We also test to see if CTRL is pressed. This condition serves as an overide for the default behavior of this macro. This would be used when we are carrying the flag in a battleground for exemple.
 * We test to see to see if we can fly.
 * This leaves us with our default, the ground mount. By now, we know that we are not swimming, not indoors, not in combat and can't fly.
 * Line 5: Dismounts you when you are mounted.

Powershift
You may have noticed the ! before every form in the travel macro. By default, when you cast a form, the UI will take you to that form. The next cast will take you out of form. The ! forces a recast of the form without going to caster. This is usefull to clear snares or roots depending on your spec.

Mount Functionality
Some users may want to remove the mount functionality from the shapeshift macros. Depending on the macro which you are using, the cast line may look slightly different. The part which you are interested in is located at the end. Delete the sections in red, add the section in green. Flight Form will be the new default and Travel Form will be used when flight is not possible.

/cast [swimming] !Aquatic Form; [indoors] !Cat Form; [combat] [noflyable] [mod:CTRL] !Travel Form; [flyable] !Swift Flight Form ; Ground Mount

Others may wish for the mount to be used when a modifier is pressed. This is not as obvious as the first exemple. Included after Travel Form, a nomod condition has to be added to the noflyable condition in order to prevent it from being the default whenever we can't fly. Included before, we need to add a nocombat condition to the mod:shift condition as we cannot mount in combat and will have to default to Travel Form if we are in combat even if shift is pressed. Here is a comparison of the changes for the 2 versions.

/cast [swimming] !Aquatic Form; [indoors] !Cat Form; [combat] [noflyable, nomod] [mod:CTRL] !Travel Form; [mod:shift] Ground Mount; [flyable] !Swift Flight Form ; Ground Mount

/cast [swimming] !Aquatic Form; [indoors] !Cat Form; [mod:shift, nocombat] Ground Mount; [combat] [noflyable] [mod:CTRL] !Travel Form; [flyable] !Swift Flight Form ; Ground Mount

Both are equaly valid. There is no real incentive to go one way or the other as we have one negation in both cases.

Stance Numbers 4.0.6
Many druid macros make use of the stance modifier to detect which form you are in. The stance numbers each refer to a Form. Be aware that Flight Form or Swift Flight Form will be either stance 5 or 6 depending on the availability of Moonkin Form and Tree of Life (druid ability).