Difference between revisions of "Macros/102"
From Roll20 Wiki
Andreas J. (Talk | contribs) m |
Andreas J. (Talk | contribs) m (1223200 moved page MTbGKP102 to Macros/101) |
Revision as of 14:20, 28 November 2021
Previous: Macros/101
Now that you know how to make a macro, let us talk about crafting a macro, what goes into a macro.
The most basic macros are simple roll commands and emotes:
These are simple macros, easy to make on the fly, but they tend to be very spammy as the /roll
command outputs a minimum of three lines by itself. This is where the Inline Roll comes into play.
[[diceroll]] [[1d20+3]] |
These macros take up less room in the chat window and are much easier to read, while still being fairly easy to write. But these macros aren't flexible at all. They do not take into account temporary modifiers to hit and damage, which fluctuate fairly chaotically in some systems. For that, we need the Roll Query.
?{Query Text|Default Option} ?{Modifier to Hit?|0} ?{TemporaryMods} |
Roll Queries will cause a dialog box to pop up and ask you for a response. You can choose to not use a default option, but that requires that you type a value because leaving that box empty will make your macro fail in any number of delightful, obscure, ways. My suggestion is to always use a default of 0 so you can just hit enter and move on with life.
/em attacks with his longsword! He his AC [[1d20+11+ ?{Modifier to Hit|0}]] for a potential [[1d10 + 7 + ?{Modifier to Damage|0}]] damage.
/em casts Healing Word, the target spends a healing surge and adds [[2d6 + ?{Any bonus healing?|0}]] additional healing.
/em attempts an Acrobatics check: [[1d20 + 5 + ?{TempMods|0}]]
/em attacks with Clever Strike. She hits AC [[1d20 + 10]] for [[1d6 + 4 + ?{Modifier to Damage|0} + ?{Sneak?|[NH]2d6} ]] potential damage.
That last macro probably looks weird. It takes advantage of the Order of Operations used in evaluating macros/commands and the fact that queries are resolved before dice rolls. This means I can choose whether to add my sneak attack dice when I attack. If I don't want to add sneak attack dice, because I can't, I just type a 0 when that box appears and the rest of the macro will execute cleanly.
These macros are more flexible than our previous batch, but when you level up you have to manually recalculate your numbers, and make sure every macro gets adjusted.
I hope this tutorial is useful.
Todo
create The next tutorial covers using Attributes inside macros: Macros/103
Originally created by GenKitty (talk) 12:01, 24 July 2015 (EDT)
Updated by Andreas J. in Nov 2021.