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 "Roll Templates"

From Roll20 Wiki

Jump to: navigation, search
m (add macro guide navbar)
m (Examples of Roll Templates)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Roll Templates are a special facet of the [[Character Sheets]] system which provide additional layout and styling options for the display of roll results.
 
Roll Templates are a special facet of the [[Character Sheets]] system which provide additional layout and styling options for the display of roll results.
 
[[File:Roll template default example2.JPG|right|thumb|350px|The output of a '''default template''' used in {{Text Chat}}]]
 
[[File:Roll template default example2.JPG|right|thumb|350px|The output of a '''default template''' used in {{Text Chat}}]]
==Using Roll Templates==
+
=Using Roll Templates=
 
{{NavMacroDocs}}
 
{{NavMacroDocs}}
 
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 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.'''
Line 7: Line 7:
 
If you're interested in using Roll Templates in your own custom macros or creating your own custom templates, read on further.
 
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 very 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 that you want to include. 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):
+
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 <code><nowiki>{{ }}</nowiki></code>-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):
  
 
<pre style="overflow:hidden;white-space:pre-wrap">
 
<pre style="overflow:hidden;white-space:pre-wrap">
Line 14: Line 14:
  
 
[[File:Roll template default example.JPG||left]]
 
[[File:Roll template default example.JPG||left]]
The <code>&{template:<template_name>}</code> 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 <code>{{<propertyname>= <value>}}</code>. The "propertyname" that you should use depends on the template -- the Character Sheet documentation should let you know what's available, 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, not a <code>/roll</code> command.
+
The <code>&{template:<template_name>}</code> 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 <code><nowiki>{{<propertyname>= <value>}}</nowiki></code>. The <code>propertyname</code> 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. <code>Value</code> can be either text or an [[Inline Roll|inline roll]], including macros, abilities, etc. Note that if you use a macro or ability, it must be an inline roll, and not a <code>/roll</code> command.
  
 
{{orange| Macros for roll templates are sensitive to leading spaces, so '''<code><nowiki>{{name=Dexterity}}</nowiki></code>''' will work, but  '''<code><nowiki>{{ name=Dexterity}}</nowiki></code>''' won't. }}
 
{{orange| Macros for roll templates are sensitive to leading spaces, so '''<code><nowiki>{{name=Dexterity}}</nowiki></code>''' will work, but  '''<code><nowiki>{{ name=Dexterity}}</nowiki></code>''' won't. }}
Line 24: Line 24:
 
</pre>
 
</pre>
  
====When Can I Use Roll Templates?====
+
==When Can I Use Roll Templates?==
 +
Which rolltemplates that are available in your game, is dependent on what [[CS|character sheet]] template is used in your game, as rolltemplates are coded into character sheets.
  
You can use a Roll Template in general messages (without a command like <code>/desc</code> or <code>/emote</code>) and whispers. You can't use roll templates with the <code>/roll</code> 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 sheets.
+
For example, to use the <code>&{template:simple}</code> 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%26D_5e_by_Roll20_Roll_Templates#Simple|D&D 5E simple template]] for more.
  
==Built-In Roll Templates==
+
You can use a Roll Template in general messages (without a command like <code>/desc</code> or <code>/emote</code>) and whispers. You can't use roll templates with the <code>/roll</code> command; instead, Roll Templates are meant to be used with inline rolls. As long as they use [[Inline Rolls|inline rolls]], you can use Roll Templates with macros, Character Abilities, and [[Sheet Author|sheet authors]] can use them inside of their [[Button#Roll Button|Roll Buttons on character sheets]].
  
The following roll templates are built-in to Roll20 and can be used in any game. You don't have to even have a character sheet template selected for your game to use it.
+
==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====
+
===Default===
 +
The '''default''' rolltemplate is built-in to Roll20, and can be used in any game, regardless of. You don't have to even have a character sheet template selected for your game to use it.
  
To use the default template, you first call <code>&{template:default}</code>, the (optionally) define what will be shown in the header in a <code><nowiki>{{name= }}</nowiki></code>-section, after which you can create any number of "rows" by creating more <code>{{ }}</code>-sections.
+
To use the default template, you first call <code>&{template:default}</code>, then (optionally) define what will be shown in the header in a <code><nowiki>{{name= }}</nowiki></code>-section, after which you can create any number of "rows" by creating more <code><nowiki>{{ }}</nowiki></code>-sections.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 41: Line 44:
 
|-
 
|-
 
| 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.'')
 
| 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 <code><nowiki>{{name= }}</nowiki></code> section, and then with every subsequent <code>{{ }}</code> segment, it will alternate with white & gray background.
+
'''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 <code><nowiki>{{name= }}</nowiki></code> section, and then with every subsequent <code><nowiki>{{ }}</nowiki></code> segment, it will alternate with white & gray background.
  
If a <code>=</code> is used in the <code>{{ }}</code> rows, the roll template will align the <code>=</code> in the middle, and all rows will have the <code>=</code> in the same spot. If any row have lots of more text/content on either side of the <code>=</code>, it will be pressed to the side of the template for all rolls.
+
If a <code>=</code> is used in the <code><nowiki>{{ }}</nowiki></code> rows, the roll template will align the <code>=</code> in the middle, and all rows will have the <code>=</code> in the same spot. If any row have lots of more text/content on either side of the <code>=</code>, it will be pressed to the side of the template for all rolls.
  
So for example, you could do the following:
+
{{ex}}
  
 
<pre style="overflow:hidden;white-space:pre-wrap">
 
<pre style="overflow:hidden;white-space:pre-wrap">
&{template:default} {{name=Test Attack}} {{attack=[[1d20]]}} {{note= This is some note content}} {{Saving Throw= vs Will}}
+
&{template:default} {{name=Test Attack}} {{attack=[[1d20+3]]}} {{note= This is some note content}} {{Saving Throw= vs Will}}
 
</pre>
 
</pre>
 
[[File:Roll template default example2.JPG]]
 
[[File:Roll template default example2.JPG]]
Line 58: Line 63:
 
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.
 
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.
  
<big>[https://jsfiddle.net/8w3qm3zL/41/ Here] is a fairly exact example of the default template with it's dependent CSS classes.</big>
+
[https://jsfiddle.net/8w3qm3zL/41/ 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 [[Building_Character_Sheets/Roll_Templates#Jakob.27s_Better_Default_Rolltemplate|Jakob's Better Default Template]].
 +
 
 +
====Examples====
 +
Some more examples using the default roll template. these should
 +
 
 +
 
 +
Roll template rolls that has [[Inline#Inline_Labels|inline labels]], which will make it easier to look at the roll breakdown(when you hover your mouse over the result).
 +
<pre style="overflow:hidden;white-space:pre-wrap">
 +
&{template:default} {{name=Mage Bolt}} {{attack=[[1d20+3[int]+2[proficiency] ]]}} {{Damage= [[3d6[base dmg]+3[int mod]+1d8[Elder Wand bonus] force dmg]]}} {{DC [[14]] Will Save= The enemy must make the save, or take an extra [[1d8]] fire dmg. }}
 +
</pre>
 +
 
 +
You can have rolls on both sides of the <code>=</code>
 +
<pre style="overflow:hidden;white-space:pre-wrap">
 +
&{template:default} {{name=Greatsword of the Nomads}} {{attack= has advantage, pick higher result}} {{[[1d20+4]]=[[1d20+4]]}} {{Damage= [[2d6+2]]}} {{If critical= Apply only if attack is critical}} {{Crit damage= deals [[2d6]] more on crit}} {{Special Crit= The Greatsword of the Nomads deals on crit an extra [[1d8]] radiant damage, and the defender needs to make a DC [[14]] Con save or gain a level of exhaustion}}
 +
</pre>
 +
 
 +
Can be useful to make several attacks at a time
 +
<pre style="overflow:hidden;white-space:pre-wrap">
 +
&{template:default} {{name=Fist of Fury}} {{Attack1= [[1d20+5]]}} {{Damage1= [[1d6+3]]}} {{Attack2= [[1d20+5]]}} {{Damage2= [[1d6+3]]}} {{Offhand= [[1d20+4]]}} {{Damage1= [[1d4+3]]}}
 +
</pre>
 +
 
 +
A macro for short rest. 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).
 +
<pre style="overflow:hidden;white-space:pre-wrap">
 +
&{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.}}
 +
</pre>
 +
 
 +
===D&D 5E by Roll20===
 +
{{main|D&D 5e by Roll20 Roll Templates}}
 +
 
 +
The [[D&D 5E by Roll20]]-character sheet has 10 built in roll templates.
 +
 
 +
{{ex}}
 +
[[File:5e-rolltemplate-ex1-2021.png|200px|right|none]]
 +
Rolls stealth for selected npc token, using it's stealth proficiency. Using the <code>&{template:npcatk}</code> template from it.
 +
<code><nowiki>/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 }}</nowiki></code>
  
 
==Creating a Roll Template==
 
==Creating a Roll Template==
Line 65: Line 104:
 
You can create & use custom Roll Templates by [[Building Character Sheets|Editing/Building Character Sheets]], as they are a part of the Character Sheet's code.
 
You can create & use custom Roll Templates by [[Building Character Sheets|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
+
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 =
 
= See Also =

Latest revision as of 17:12, 7 June 2021

Roll Templates are a special facet of the Character Sheets system which provide additional layout and styling options for the display of roll results.

The output of a default template used in q Text Chat

Contents

[edit] Using Roll Templates

Macro Creation

Advanced

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):

&{template:default} {{name=Test Attack}} {{attack=[[1d20]]}} {{damage=[[2d6]]}}
Roll template default example.JPG

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.


Here's an example that uses a %{Character|attack} ability:

&{template:default} {{name=Test With Ability}} {{attack= %{Character_Name|attack} }} {{damage= #damagemacro }}

[edit] 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.

[edit] 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.

[edit] Default

The default rolltemplate is built-in to Roll20, and can be used in any game, regardless of. You don't have to even have a character sheet template selected for your game to use it.

To use the default template, you first call &{template:default}, then (optionally) define what will be shown in the header in a {{name= }}-section, after which you can create any number of "rows" by creating more {{ }}-sections.

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:

&{template:default} {{name=Test Attack}} {{attack=[[1d20+3]]}} {{note= This is some note content}} {{Saving Throw= vs Will}}

Roll template default example2.JPG

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.

[edit] Examples

Some more examples using the default roll template. these should


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).

&{template:default} {{name=Mage Bolt}} {{attack=[[1d20+3[int]+2[proficiency] ]]}} {{Damage= [[3d6[base dmg]+3[int mod]+1d8[Elder Wand bonus] force dmg]]}} {{DC [[14]] Will Save= The enemy must make the save, or take an extra [[1d8]] fire dmg. }}

You can have rolls on both sides of the =

&{template:default} {{name=Greatsword of the Nomads}} {{attack= has advantage, pick higher result}} {{[[1d20+4]]=[[1d20+4]]}} {{Damage= [[2d6+2]]}} {{If critical= Apply only if attack is critical}} {{Crit damage= deals [[2d6]] more on crit}} {{Special Crit= The Greatsword of the Nomads deals on crit an extra [[1d8]] radiant damage, and the defender needs to make a DC [[14]] Con save or gain a level of exhaustion}}

Can be useful to make 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]]}}

A macro for short rest. 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.}}

[edit] 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:

5e-rolltemplate-ex1-2021.png

Rolls stealth for selected npc token, using it's 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 }}

[edit] 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.

[edit] See Also