Advanced Macro Creation

This is a guide on how to create your own advanced macros.  If you need help or have questions, feel free to contact Dag.

## Templates

In the Simple Macros for Beginners, we learned how to create attack macros using emotes like this:

/me slashes at the enemy with his greatsword! [[d20+4]] vs AC for [[2d6+6]] slashing damage

Which looks like this:

Instead of using emotes to express your macros, you can also use a template.  The template adds color and groups up your macro so it can be clearly seen. There are 2 styles of templates I will be covering in this guide.  The first is the default template.  The second would be the pathfinder template.

To begin, you need to set up the type of template you want to use.  The default template section looks like this:

&{template:default}

After this, you will add the description of what you are doing in the macro.  Add a space after the template section and then add the description section which looks like this:

{{name=Dag slashes at the enemy with  his greatsword!}}

To add a section on the next line down, you would add a space after the description section and then add what we will call the action section which looks like this:

{{Greatsword:=[[d20+4]] vs AC}}

You can add as many action sections as you like at this point.  Each action section will be displayed as another line in the chat log. All you need to do is add a space after the previous action section then enclose the next action section with double brackets. We will add one more action section for the damage which looks like this:

{{Damage:=[[2d6+6]] slashing}}

The full greatsword macro should now look like this (all on the same line with only spaces between the sections):

&{template:default} {{name=Dag slashes at the enemy with  his greatsword!}} {{Greatsword:=[[d20+4]] vs AC}} {{Damage:=[[2d6+6]] slashing}}

Which looks like this:

The generic pathfinder template is similar, but you can also specify which color you want the template to be.  The template section changes, and you would add a color section after the description section. In the color section you can specify any color including light or dark versions of the same color (like blue, or dark blue) The same greatsword macro would look like this instead:

&{template:pf\_generic} {{name=Dag slashes at the enemy with  his greatsword!}} {{color=azure}} {{Greatsword:=[[d20+4]] vs AC}} {{Damage:=[[2d6+6]] slashing}}

Which looks like this:

Variables

It can be tedious to use a macro when your bonuses are always changing.  No one likes to have a great macro to roll, and then say “oh, thats plus 1 because of bless and plus 2 for flanking”.  Similarly its a pain in the fucking ass to roll your damage and say “Oh thats plus 1 damage because im shooting within 30’ and have point blank shot”.  Fortunately, we can add variables to the macros so that you can customize your bonuses as you roll!  In its simplest form, a variable would look like this:

?{variable|0}

The “0” value will prompt you to input a number when you roll the macro.  Using the default template and our greatsword macro, the new macro with the variable would look like this:

&{template:default} {{name=Dag slashes at the enemy with  his greatsword!}} {{Greatsword:=[[d20+?{variable|0}]] vs AC}} {{Damage:=[[2d6+6]] slashing}}

The prompt will look like this when you use the macro:

And the end result will look essentially unchanged from the original:

You can add multiple variables into your macros, but each one has to have a different name if you want to input different values. For each uniquely named variable, you will get another prompt.  If you use identical variables, you will only be prompted for a value once, and each time the variable occurs in your macro, that same value will be substituted every time. Let’s say we wanted to add a variable for the damage of our greatsword.. For instance if we wanted to use the same macro whether or not we were power attacking. The attack bonus variable we will rename to “attack” and the damage bonus variable we will rename to “damage” Entering “0” into damage would give us the damage without the power attack.  Entering “3” (the damage of power attack using a greatsword at lvl 1) will give us the power attack damage instead. The macro would look like this:

&{template:default} {{name=Dag slashes at the enemy with  his greatsword!}} {{Greatsword:=[[d20+?{attack|0}]] vs AC}} {{Damage:=[[2d6+6+?{damage|0}]] slashing}}

And the end result would look essentially unchanged from the original:

Advanced Variables

Lets go one step further.  You can create variables with multiple options instead of variables that ask you to input a value. We will call these “advanced variables”.  An advanced variable will prompt you with a drop-down menu and ask you to choose which option you are using. Advanced variables will look like this:

?{variable|option1, A|option2, B|option3, C}

You can add as many options as you like, but all options have to have a unique name followed by a comma, then a space, and then the value (expressed in this example as the letters A, B and C)

Suppose you wanted to keep the variable that asked you for your normal bonus, and then also add another advanced variable that asked you if your attack bonus was affected by using power attack. Our greatsword macro would then look like this:

Assuming I was a lvl 1 paladin, the advanced variable would allow the bonus to remain unchanged “0” if I was not power attacking, but subtract 1 from the attack if I was power attacking.

The prompts would then look like this:

Then this (notice the drop-down menu which allows you to select either “no” or “yes” as we specified:

Then finally this:

And the result would look essentially unchanged from the original macro:

Now lets say we wanted to add another advanced variable to prompt us about damage bonuses.  For instance, lets say we wanted to replace the damage variable with another advanced variable that would let us add extra crit damage whether or not the attack was a power attack. The first option would be damage with the bonus power attack damage of 3.  The second option would be the attack damage without power attacking, but doubling the normal damage for a critical strike. The final option would add double the damage for the critical strike, as well as double the damage of a normal power attack which would be 6.

That would look like this:

?{damage|power attack, 3|crit, 2d6+6|power attack with crit, 2d6+6+6}

And the entire macro would look like this:

And finally this (note that this drop-down menu will have 3 options instead of just 2)

And the result would look essentially unchanged from the original, just with far more damage:

Nesting Macros

We can also use macros within macros, however you must change the syntax of certain characters.  There are three characters that must be altered in this way in order to make the macro work.  Those characters are as follows:

Character Replacement

, &#44;

} &#125;

Suppose our paladin hits level 6, and now has a second iterative attack when he full attacks.  We can create 1 macro that gives us the option of using a standard attack as well as a full attack. For clarity, I will show this using an attack-only macro. (we would use a separate macro altogether for damage.  You CAN combine both into the same macro, but if you do your turn will take forever as you go through all the menus and drop down menus for this).

Our attack-only macro from the above example (minus the advanced variable) would look like this:

&{template:default} {{name=Dag slashes at the enemy with  his greatsword!}} {{Greatsword:=[[d20+?{attack|0}]] vs AC}}

Adding the iterative attack to the macro would look like this:

The reason this is a nesting macro is that it is within the second advanced variable.  The drop down menu will essentially ask you “are you taking a second attack” and if you answer is “no”, then nothing will be added, and the result will look like all the others we have done so far. If we choose “yes”, then that spawns a second macro with its own attack variables.  In this example the second iterative attack is taken at a -5 to-hit per pathfinder rules.  We keep the same variable for attack bonus in both attack macros because otherwise, both attacks use the same bonus. As stated before, if both variables have identical names, it will only ask your input once, and apply the answer every time that variable occurs in the macro.  In order for the second nesting macro to work, however, we have to replace the problematic characters with their HTML version.

Changing the problematic characters will look like this:

&{template:default} {{name=Dag slashes at the enemy with  his greatsword!}} {{Greatsword1:=[[d20+?{attack|0}]] vs AC}} ?{second attack|no, |yes, {{Greatsword2:=[[d20-5 +?{attack&#124; 0 &#125; ]] vs AC} }}

Note that all the problematic characters within the second set of brackets [[ ]] had to be changed.

Now, suppose we want to create a different kind of nesting macro.  One in which we could use an advanced variable to choose to use one of several different secondary macros.  For instance, say we wanted to use one single macro for saving throws, but wanted different flavor texts for each one.  This can be done using a nesting macro. First, we need to create the secondary macros like this (the name of the macro in black, the macro itself in red):

#DagF  Fortitude:=[[d20+7]] #DagR Reflex:=[[d20+5]], #DagW Will:=[[d20+4]]

Now we can create a macro that lets us choose which secondary macro we want to use.  It would look like this:

The flavor text options are within the description section inside an advanced variable.  Similarly, the secondary macros are nested inside the action section within a second advanced variable.

When using this type of macro, make sure you choose the same saving throw option for both advanced variables.

Target Variables

Suppose we wanted to use our greatsword macro, but customise it so that instead of the description section saying “the enemy” it would specify the actual name of the enemy we were attacking.  We can actually do that using a target variable.

A target variable looks like this:

 @{target|Token\_Name}

Using our original greatsword macro, we can replace the words “the enemy” with our target variable, and the new macro would look like this:

&{template:default} {{name=Dag slashes at the @{target|Token\_Name} with  his greatsword!}} {{Greatsword:=[[d20+4]] vs AC}} {{Damage:=[[2d6+6]] slashing}}

The prompt for this variable will look like crosshairs that you can move around the screen until you select the enemy you want to attack by left clicking on the enemy token itself. (This works only if the enemy token is ‘named’)