Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Difference between revisions of "Macros/Nested Macros"

From Roll20 Wiki

Jump to: navigation, search
m
m
Line 1: Line 1:
<noinclude>{{revdate}}{{main|Macros}}{{clear}}
+
<noinclude>{{revdate}}{{main|Roll Queries & Nesting}}{{clear}}
 
{{NavMacroDocs}}</noinclude>
 
{{NavMacroDocs}}</noinclude>
 
Macros can be nested inside each other, which gives the ability to combine macros, and call multiple macros with a single action. To nest a macro, simply include the name of the macro you wish to call on its own line inside your macro.
 
Macros can be nested inside each other, which gives the ability to combine macros, and call multiple macros with a single action. To nest a macro, simply include the name of the macro you wish to call on its own line inside your macro.

Revision as of 14:49, 30 November 2021

Main Page: Roll Queries & Nesting

Macros can be nested inside each other, which gives the ability to combine macros, and call multiple macros with a single action. To nest a macro, simply include the name of the macro you wish to call on its own line inside your macro.

Example

In this example, we'll have three macros: #damage, #attack, and #both

Macro #damage

/roll 1d4+11

Macro #attack:

/roll 1d20+9

Macro #both:

#attack
#damage

Nesting in a Roll Query

If you are nesting a macro in a Roll Query, make sure there is a space after the macro name, and no space between the , and # so that it is properly recognized by Roll20.

?{Which macro?|Attack,#use-sword |Defend,#use-shield }

Troubleshooting

Due to the order of operations, Macro calls nested within Roll Query are fully expanded before the Roll Query is executed. This means that if a macro nested within a Roll Queries contains any "problematic characters" that conflict with Roll Query syntax (such as } , and |), that nested macro may cause the Roll Query to break (because the Roll Query will treat problematic characters in the called macro as Roll Query syntax).

If this is the case, it may be necessary to either remove those problematic characters (within the called macro itself), or replace them with HTML Entities.

Macros which contain HTML replacement entities may no longer function outside of a Roll Query, and should be saved as Abilities.

Reopening a l Collections Macro reverts HTML entities; if that Macro is then saved, those reversions are as well. This behaviour is not present within Abilities.