Character Vault
Any Concept / Any System
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 "Complete Guide to Macros & Rolls"

From Roll20 Wiki

Jump to: navigation, search
m (Roll Button)
m (Roll Templates)
Line 71: Line 71:
* default roll template
* default roll template
* sheet-specific
* sheet-specific
[ Use Images in the Default Template] - trick
If you want to dress up your default template, you can stuff an image in the name portion instead of just text:

Revision as of 15:32, 25 September 2020

This is mean to serve as a comprehensive guide & starting point for figuring out how the q Text Chat, Dice Rolling, Macros and related things work and interact with each-other, and to list everything you can write/make appear in the q Text Chat.

This is both for Players/Gamemasters who are just writing their own custom rolls or macros to be used in their game, as well as those who build Character Sheets and are creating/editing Roll Buttons for their sheets.



The q Text Chat page shows the basic commands that can be used in the chat, such as /roll(or /r) for making simple rolls, /em for emoting text, /w for whispering to someone, and /gmroll(or /gr) for sending simple rolls to the GM.

You can write in the q Text Chat normal text without using any commands like /r.

Chat Commands

Beyond using the various Roll Commands shown on the q Text Chat-page, here are some other examples of what you can write in the q Text Chat:

  • Macros - Start with #, and start typing the macro name, and a list of your macros will be displayed.
    • Example: writing #testmacro in the chat will roll the macro with that name
  • Roll Templates - &{template:name-of-roll-template} {{sectionname(optional)=content of roll template}}.
    • The Default Roll Template is available in any games, other templates are tied to specific Character Sheet Templates. (E.g. you can only access the specific &{template:simple} when you have D&D 5E by Roll20-sheet in the game).
    • Example: &{template:default} {{name=Test Attack}} {{attack=[[1d20]]}} {{damage=[[2d6]]}}
    • This will generate a roll template using the default template, displaying "Test Attack" in the purple title, then on a new row the result of 1d20 roll, and on the third row the 2d6 roll
  • Character Abilities/Character Sheet Button - %{character name|ability or roll button name}
    • Example 1; writing %{Sam Bobbins|initiative} in the chat, will work if there exists a Character with that name, who have a Character Ability/Character Sheet Roll Button by that name
    • Example 2: selecting a [Token]] on the map, and then writing %{selected|initiative} in the chat, will work if the token is linked to a character sheet that has an Ability or Roll button with that name.
  • API commands(available in games hosted by a pro user), - Start with ! to call the API command, and then write and parameters it can take
    • Example: writing !MassInit in the chat will trigger an API that uses MassInit as a keyword.

Dice Syntax

The Dice Reference page shows how the syntax for the Roll20 dice rolling works, and all the advanced alternatives you can use, such as rolling Fate Dice, or counting successes rather than the sum of the rolls.


The Macros page lists all the the other kind of options for modifying rolls that isn't covered by the Dice Reference-page.

Features include

  • selected/target
  • roll queries
  • nested queries
  • suppress error message
  • Reusing Rolls



To send a roll result directly to the Turn Tracker, first, select the Token you wish to roll initiative for, and then make a roll that includes the &{tracker} option.


  • /roll 1d20 + 5 &{tracker}
  • &{template:default} {{name=Initiative}} {{Roll=[[1d20+5]]}} &{tracker}

See also: Cards#Using_Cards_for_Initiative_Order

Roll Table

If you have Roll Tables on your l Collections-tab, they can be used in rolls & macros.


Let's assume there exist a roll table with the name fumble.

You can roll a table directly in the chat input, or in a macro, simply as 1t[fumble].

Example 2: To roll your "crit-failure" table two time, you would enter /roll 2t[crit-failure]. You can change 2 to whatever number you would like. However, this currently does not work with inline rolls.

You can also roll a table inline in chat or a macro by wrapping it in double square brackets like this [[1t[table-name]]]. Currently, any number beyond 1 does not display for the inline roll, the results are show on mouseover though.

Roll Templates

Main Page: Roll Templates

  • default roll template
  • sheet-specific

Use Images in the Default Template - trick

If you want to dress up your default template, you can stuff an image in the name portion instead of just text:



The Stupid Roll20 Tricks (and some clever ones) contains a large amount of tricks and examples of clever uses for macros etc.

  • Reusing Rolls - clever trick to reuse rolls withing the same command. Was discovered in mid-2020.

Token Actions

Token Actions are specially-designated macros and character abilities (with tokens representing a character) which appear whenever a token is selected on the screen. They appear in a bar along the top of your screen, and the contents of the bar are context-sensitive. When you select a token, all macro token actions will be shown, as well as ability token actions for the token's linked character (if applicable).


API commands start with ! and then the name of the API command, and then write any other parameters for the API. The specific API script need to be installed in the game for this to work.

Example 1: writing !wd [[4d6+2]] in the chat will trigger the Script:Wild Dice script to make a custom roll output, rolling 3 normal d6 dice, and one Wild Die, presenting it in a table. If the Wild Die comes up as a "1", it, and the value of the highest dice is removed form the roll total. This is not something that can be done with macros alone, which is why this API was created.


Example 2:

writing !group-init in the chat will trigger the GroupInitiative(must be installed) API that uses group-init as a keyword. This particular API command would roll initiative order for all selected tokens, if the API is configured to know what stats to roll.

Example 3:

writing &{template:default} {{name=Cthulhu}} !modattr --silent --charid @{target|character\_id} --sanity|-{{Sanity damage=[[2d10+2]]}} --corruption|{{Corruption=Corruption increases by [[1]]}}!!! {{description=Text}} in the chat, and selecting a Token on the map, will decrease sanity by 2d10+2 and increase corruption by 1 for the character selected.

This is the ChatSetAttr API, which can be used standalone with the !modattr command, but more notably, can be incorporated into regular macros, resulting in you being able to both make rolls and have the result change the stats.

Character Sheet Creation

Info and links to things that are only relevant or usable for when you're Building/Editing Character Sheets. Consult the rest of the guide for general details.

Roll Button

The rest of this guide will help in creating more complicated macros, but the main Button#Roll_Button-page have some concrete examples of how macros are implemented in character sheets.


With the info from Macros, fairly complex outputs to the q Text Chat can be made, but to be able to construct complex and dynamic results based on various factors on your character sheet, you will need to use JavaScript to write Sheet Worker Scripts that modify & construct your roll output dynamically.

Roll Template

When you create/edit a character sheet, you can make your own Roll Templates to make your roll output look like you want, and to do some conditional things such as only showing some sections in case of a critical roll in another sections.

See Roll_Templates#Creating_a_Roll_Template for more.

Roll_Templates#Helper_Functions describes what functions you can build into your sheets.

Related Pages

  • Complete Guide to Macros & Rolls‎
    • q Text Chat - where the roll results appear, & info on the common chat commands
    • Dice Reference - Comprehensive list of how the Roll20 dice-rolling syntax works, and list the features available
    • Macros - How to create macros, and other info on how the Roll20 qText Chat works, like referencing stats on character sheets, roll queries, nesting macros & initiative
    • Roll Templates - a method of formatting roll results in the chat, with some extra functions
    • API(Pro Only) - API commands can be used in the qText Chat


  • add image examples of macros used, input + output
  • Roll Template examples
  • Dig up examples from "Stupid Tricks" thread.