Roll Templates
From Roll20 Wiki
Page Updated: 2023-01-11 |
Roll Templates are a special facet of the Character Sheets system which provide additional layout and styling options for the display of roll results.
Contents |
Using Roll Templates
Macro Creation
- Complete Guide to Macros & Rolls
- q Text Chat
- Dice Reference
- Order of Operations
- Macros
- Token Reference
- Character Reference
- Roll Templates
- Roll Table
Advanced
- Formatting
- HTML Replacement
- Chat Menus
- Hidden Rolls
- Advanced Macro Tips
- API Commands
- Char Sheet Creation
- External tools
Misc.
If you're using a Character Sheet, there's a really good chance you'll use a Roll Template just by clicking the roll button on the sheet, or by calling a sheet roll in a macro or ability. You don't have to do anything extra to do this, it's already set up for you in advance by the sheet author.
If you're interested in using Roll Templates in your own custom macros or creating your own custom templates, read on further.
Using a roll template is pretty easy. Just include a special flag in your chat message which tells Roll20 that you want to use a Roll Template, and then provide all of the data for the rolls and info that you want to include inside {{ }}
-sections . Here's an example that uses the "default" template (which all games have access to, regardless of the game system or character sheet you are using):
The &{template:<template_name>}
is the part that tells the system to use a Roll Template, and specifies the name of the template you want to use. Then you just provide all the data for the template in the format {{<propertyname>= <value>}}
. The propertyname
that you should use depends on the template, and sometimes can be whatever you want -- the Character Sheet documentation should let you know what's available(or you can take a look at existing macros and see how they are structured), and we've provided documentation on all of the built-in templates below. Value
can be either text or an inline roll, including macros, abilities, etc. Note that if you use a macro or ability, it must be an inline roll, and not a /roll
command.
Macros for roll templates are sensitive to leading spaces, so {{name=Dexterity}} will work, but {{ name=Dexterity}} won't. |
Here's an example that uses a %{Character|attack}
ability:
When Can I Use Roll Templates?
Which rolltemplates that are available in your game, is dependent on what character sheet template is used in your game, as rolltemplates are coded into character sheets.
For example, to use the &{template:simple}
template that is used on the D&D 5E by Roll20 sheet for Ability & Skill rolls, you need to have that sheet template in your game, or it won't work. See D&D 5E simple template for more.
You can use a Roll Template in general messages (without a command like /desc
or /emote
) and whispers. You can't use roll templates with the /roll
command; instead, Roll Templates are meant to be used with inline rolls. As long as they use inline rolls, you can use Roll Templates with macros, Character Abilities, and sheet authors can use them inside of their Roll Buttons on character sheets.
Examples of Roll Templates
Here are some examples of roll different templates. Only the default template is available in any game, the others can be used if the corresponding sheet is used in your campaign.
Default
Main Page: Default Roll Template
The Default Roll Template is available in all Roll20. You don't have to even have a character sheet template selected for your game to use it.
Property | Expected Value |
---|---|
name | The name of the roll, shown in the header of the roll listing. (If not used in a roll, the header will appear at the top of the roll template as a purple bar with no text.) |
(anything) | You can have any number of rows with any name you want, making the template somewhat flexible. The "property" name will be bold. |
The default template is special, and will list out whatever argument you give it in a table. It will put in the middle of the purple header anything you define in the {{name= }}
section, and then with every subsequent {{ }}
segment, it will alternate with white & gray background.
If a =
is used in the {{ }}
rows, the roll template will align the =
in the middle, and all rows will have the =
in the same spot. If any row have lots of more text/content on either side of the =
, it will be pressed to the side of the template for all rolls.
Example:
Notice that the content of the roll template is pressed to the left side, due the text segment on the Note-row. If that segment is removed, the content of the remaining rows will be closer to the center.
Here is a fairly close example of the default template's HTML& CSS with it's dependent CSS classes. If you intend to make your own roll template, or want to start from the default template, the best idea is to start with the code from Jakob's Better Default Template.
Examples
Some more examples using the default roll template. These should give more examples on how they can be used.
Roll template rolls that has inline labels, which will make it easier to look at the roll breakdown(when you hover your mouse over the result).
You can have rolls on both sides of the =
Several attacks at a time
&{template:default} {{name=Fist of Fury}} {{Attack1= [[1d20+5]]}} {{Damage1= [[1d6+3]]}} {{Attack2= [[1d20+5]]}} {{Damage2= [[1d6+3]]}} {{Offhand= [[1d20+4]]}} {{Damage1= [[1d4+3]]}}
Short Rest Macro
It asks you how many to spend & what hit dice to use, and displays how much was recovered as well as how many where spent(using the Reusing Rolls-trick).
&{template:default} {{name=Short Rest}} {{Recover= You heal [[ [[?{How many hit dice do you spend?|1}]]?{What's your Hit dice?|d4|d6|d8|d10|d12} ]] hit points, having spent $[[0]] of their hit dice.}}
Show Token info
Select a token on the map, and call this macro to get info on the token. If the token represents a character, it will show it's character_id
& character_name
, otherwise just show "selected|character_id" & "selected|character_name" if they are missing.
&{template:default} {{name=Token Info }} {{TokenID=@{selected|token_id} }} {{CharacterID=@{selected|character_id} }} {{TokenName=@{selected|token_name} }} {{characterName=@{selected|character_name} }} {{Bar1=@{selected|bar1} / @{selected|bar1|max} }} {{Bar2=@{selected|bar2} / @{selected|bar2|max} }} {{Bar3=@{selected|bar3} / @{selected|bar3|max} }} &{error}
D&D 5E by Roll20
Main Page: D&D 5e by Roll20 Roll Templates
The D&D 5E by Roll20-character sheet has 10 built in roll templates.
Example:
Rolls stealth for selected npc token, using its stealth proficiency. Using the &{template:npcatk}
template from it.
/w gm &{template:npcatk} {{attack=1}} {{name=Shadow}} {{rname=Shadow Stealth}} {{rnamec=Hide}} {{r1=[[@{selected|d20}+@{selected|npc_stealth} + 6]]}} {{always=1}} {{r2=[[@{selected|d20}+@{selected|npc_stealth} + 6]]}} {{description=While in dim light or darkness, the shadow can take the Hide action as a bonus action. Its stealth bonus is **also** improved to +6 }}
Pathfinder by Roll20
Main Page: Pathfinder by Roll20/Roll Templates
The Pathfinder by Roll20 character sheet has two different templates, one for PC (&{template:pc}
) and one for NPC (&{template:npc}
), that individually handles every types of roll.
They share mostly the same fields but are styled differently, and the NPC template handles attacks slightly differently. Otherwise, they generally can be used indifferently for macro purpose.
Example with PC template:
&{template:pc} {{showchar=[[1]]}} {{charname=charname}} {{name=name}} {{type=ability}} {{roll=roll}} {{descflag=1}} {{desc=desc}} {{shownotes=[[1]]}} {{notes=notes}}
Creating a Roll Template
Main Page: Building Character Sheets/Roll_Templates
You can create & use custom Roll Templates by Editing/Building Character Sheets, as they are a part of the Character Sheet's code.
The main page details what parts & features goes into creating a roll template, along with showing the code for a number of existing Roll Templates.
See Also
- 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(Proinfo Only) - API commands can be used in the qText Chat
- Building Character Sheets
- Creating Roll Templates
- Sheet Author Tips More advanced tips for creating/maintaining sheets, workflow, & useful tools
- Sheet Sandbox – the better editor to use when you code your character sheets
- Official version of this page - Often lacking compared to any pages on sheet development on the community wiki