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 "Inline Rolls"

From Roll20 Wiki

Jump to: navigation, search
(Inline Rolls)
m (Inline Labels: more examples)
 
(9 intermediate revisions by one user not shown)
Line 1: Line 1:
''Main Page:'' '''[[Complete Guide to Macros & Rolls#Inline Rolls]]'''
+
{{revdate}}''Main Page:'' '''[[Complete Guide to Macros & Rolls#Inline Rolls]]'''
[[File:Roll template default example2.JPG|left|thumb|300px|The output of a '''default template''' that shows an '''inline roll'''(yellow box) ]]'''Inline Rolls''' refers to the numerical roll result in(usually yellow) boxes that is displayed in the {{Text Chat}}, and the double bracket syntax <code><nowiki>[[2d6+2]]</nowiki></code> used for creating them. They can be used both in user-made [[macros]](Free) as well as [[API Scripts]]({{Pro}} feature).
+
[[File:Roll template default example2.JPG|right|thumb|300px|The output of a '''default [[Roll Template|roll template]]''' that shows an '''inline roll'''(yellow box) ]]
{{NavMacroDocs}}
+
__TOC__
+
 
<br>
 
<br>
 +
'''Inline Rolls''' refers to the numerical roll result in(usually yellow) boxes that is displayed in the {{Text Chat}}, and the double bracket syntax <code><nowiki>[[2d6+2]]</nowiki></code> used for creating them. They can be used both in user-made [[macros]](Free) as well as [[API Scripts]]({{Pro}} feature).
 +
<br clear=left>
 +
__TOC__
 +
<br clear=right>
 +
{{NavMacroDocs}}
 
==Inline Rolls==
 
==Inline Rolls==
If you use simple roll commands/macros like <code>/roll 2d10+5</code>, the whole command is a dice roll. But when you use [[Roll Templates]], or want to have embedded dice rolls within other commands like <code>/em</code>, you use '''inline rolls'''. '''Inline Rolls''' are wrapped in double brackets(<code><nowiki>[[ ]]</nowiki></code>) around the calculation for it to be processed.  
+
If you use simple roll commands/macros like <code>/roll 2d10+5</code>, the whole command is a dice roll, and the individual rolled dice & their results are displayed in the {{Text Chat}}.
  
The result of "Normal" dice rolls is shown as individual dice images displaying the result on each dice separately, along with the total result, while inline roll results are displayed in as a single numerical result, where you can see the roll breakdown by hovering your mouse over the result.  
+
[[File:Deftemplate-roll-hover-result.gif|left|thumbnail|300px|hovering over the result will show the breakdown of what went into the roll, and it's formula. See Ex.3 for the macro.]]
 +
 
 +
<br>But when you use [[Roll Templates]], or want to have embedded dice rolls within other commands like <code>/em</code>, you use '''inline rolls''', which results are displayed as just a final sum(the yellow box in the example). '''Inline Rolls''' are wrapped in double brackets(<code><nowiki>[[ ]]</nowiki></code>) around the calculation for it to be processed.
 +
 
 +
 
 +
The result of "Normal" dice rolls is shown as individual dice images displaying the result on each dice separately, along with the total result, while inline roll results are displayed in as a single numerical result, where you can see the roll breakdown by hovering your mouse over the result.<br clear=left>
  
 
Inline rolls are just like regular rolls, with the following exceptions:
 
Inline rolls are just like regular rolls, with the following exceptions:
Line 13: Line 21:
 
* You can use them in any chat message, not just a roll. For example, you can do a regular chat message, an emote(<code>/em</code>), or a whisper(<code>/w</code>), with an inline roll included.
 
* You can use them in any chat message, not just a roll. For example, you can do a regular chat message, an emote(<code>/em</code>), or a whisper(<code>/w</code>), with an inline roll included.
 
** '''Ex.''' <code><nowiki>/w alice the silent curse will affect you for [[2d4]] days.</nowiki></code>
 
** '''Ex.''' <code><nowiki>/w alice the silent curse will affect you for [[2d4]] days.</nowiki></code>
* They are evaluated completely before any (<code>/roll</code>) commands, so you can use them as "random variables" in your rolls. See [[Dice_Reference#Order_of_Operations|Order of Operations]] for more.
+
* They are evaluated completely before any (<code>/roll</code>) commands, so you can use them as "random variables" in your rolls. See [[Order of Operations]] for more.
 
* You see only the total roll result by default, by the dice roll breakdown can be seen if you hover your mouse over the result.
 
* You see only the total roll result by default, by the dice roll breakdown can be seen if you hover your mouse over the result.
 
** Using [[Complete_Guide_to_Macros_%26_Rolls#Inline_Labels|inline labels]] in rolls will make it easier to understand more complex rolls
 
** Using [[Complete_Guide_to_Macros_%26_Rolls#Inline_Labels|inline labels]] in rolls will make it easier to understand more complex rolls
Line 26: Line 34:
  
 
===Examples===
 
===Examples===
<pre>
+
[[File:Inlineroll-ex-em.gif|left|frame]]
 +
<pre style="overflow:auto;white-space:pre-wrap;">
 
/em swings their sword and does [[2d6+2]] damage.
 
/em swings their sword and does [[2d6+2]] damage.
 
</pre>
 
</pre>
<pre>
+
<pre style="overflow:auto;white-space:pre-wrap;">
 
&{template:default} {{name=Test Attack}} {{attack=[[1d20+5]]}}
 
&{template:default} {{name=Test Attack}} {{attack=[[1d20+5]]}}
 
</pre>
 
</pre>
<pre style="overflow:hidden;white-space:pre-wrap">
+
<br clear=right>
 +
<pre style="overflow:auto;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. }}
 
&{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>
 
</pre>
  
 
==Inline Labels==
 
==Inline Labels==
If you want to include additional comments before the end of the roll (we call them "inline labels"), use square brackets. For example, <code>/roll 2d10+5[Fire Damage] + 3d6[Ice Damage]</code>. Inline labels works both with "normal" rolls and '''inline rolls'''.  
+
[[File:Inline-label-example.png|right|normal roll with inline labels]]
 +
If you want to include description or explanations to what individual dice or modifiers represent in you rolls, you can introduce '''inline labels''', by using use square brackets in the macro. For example, <code>/roll 2d10+5[Fire Damage] + 3d6[Ice Damage]</code>. Inline labels works both with "normal" rolls and '''inline rolls'''. See the earlier gifs for inline label examples in inline rolls.
  
 
When these comments are applied directly after a die roll they show up as tool-tips on the dice:
 
When these comments are applied directly after a die roll they show up as tool-tips on the dice:
Line 45: Line 56:
  
 
This is especially useful if a roll contains multiple variables and you want to look up what number comes from what attribute.
 
This is especially useful if a roll contains multiple variables and you want to look up what number comes from what attribute.
 +
 +
[[File:Inline-label-inline-roll.png|thumbnail|center|400px|Example of inline label use in a roll template, from the [[Mythic D6]] sheet.]]
 +
 +
Examples:
 +
* <code>&{template:default} {{name=Str}} {{attack=[[1d20+[[floor(12/5)]][Str] ]]}}</code>
 +
* <code>&{template:default} {{name=Magic blast}} {{Damage=[[3d6[Base]+3[Caster Level]+1[Efrit Racial Bonus] ]] Fire Damage}}</code>
  
 
'''You can even use sheet attributes in labels.''' Especially useful if the name of the stat can be customized by the user, so the corresponding label should change to reflect the name.
 
'''You can even use sheet attributes in labels.''' Especially useful if the name of the stat can be customized by the user, so the corresponding label should change to reflect the name.
 
{{ex}}
 
{{ex}}
<pre>
+
<pre style="overflow:auto;white-space:pre-wrap;">
 
/r @{selected|customskill1}d6[@{selected|customskill1name}] + @{selected|str}[str]
 
/r @{selected|customskill1}d6[@{selected|customskill1name}] + @{selected|str}[str]
 
</pre>
 
</pre>
 +
 +
==Tricks==
 +
* {{fpl|8851426/ Inline Rolls in Rollable Tables}} - Eric B
 +
** {{fpl|8851529/ followup}}
 
==Related Pages==
 
==Related Pages==
* [[Complete Guide to Macros & Rolls]]
+
* '''[[Complete Guide to Macros & Rolls]]'''
* [[Roll Templates]]
+
** [[Roll Templates]]
 
* [[API:Script Index]]
 
* [[API:Script Index]]
 +
<br><br>
 +
[[Category:Macros]]

Latest revision as of 12:36, 24 April 2022

Main Page: Complete Guide to Macros & Rolls#Inline Rolls
The output of a default roll template that shows an inline roll(yellow box)


Inline Rolls refers to the numerical roll result in(usually yellow) boxes that is displayed in the q Text Chat, and the double bracket syntax [[2d6+2]] used for creating them. They can be used both in user-made macros(Free) as well as API Scripts(
Pro
info feature).


Contents


[edit] Inline Rolls

If you use simple roll commands/macros like /roll 2d10+5, the whole command is a dice roll, and the individual rolled dice & their results are displayed in the q Text Chat.

hovering over the result will show the breakdown of what went into the roll, and it's formula. See Ex.3 for the macro.


But when you use Roll Templates, or want to have embedded dice rolls within other commands like /em, you use inline rolls, which results are displayed as just a final sum(the yellow box in the example). Inline Rolls are wrapped in double brackets([[ ]]) around the calculation for it to be processed.


The result of "Normal" dice rolls is shown as individual dice images displaying the result on each dice separately, along with the total result, while inline roll results are displayed in as a single numerical result, where you can see the roll breakdown by hovering your mouse over the result.

Inline rolls are just like regular rolls, with the following exceptions:

  • You can use them in any chat message, not just a roll. For example, you can do a regular chat message, an emote(/em), or a whisper(/w), with an inline roll included.
    • Ex. /w alice the silent curse will affect you for [[2d4]] days.
  • They are evaluated completely before any (/roll) commands, so you can use them as "random variables" in your rolls. See Order of Operations for more.
  • You see only the total roll result by default, by the dice roll breakdown can be seen if you hover your mouse over the result.
    • Using inline labels in rolls will make it easier to understand more complex rolls
  • Highlights (Critical Successes & Failures) are highlighted
    • If an inline roll contains a critical success, it will be highlighted with a green border.
    • If there's a critical failure, it's highlighted in red.
    • If it contains both, it's in blue.

Also when you mouse-over the inline roll to see the details of the roll, it'll show red and green highlights for the individual dice that rolled crits/fumbles.

With inline rolls, the numerical end result is shown in a (yellow) box, and if you hover you mouse over the result, you see the full equation of the roll, along with the result of each.

[edit] Examples

Inlineroll-ex-em.gif
/em swings their sword and does [[2d6+2]] damage.
&{template:default} {{name=Test Attack}} {{attack=[[1d20+5]]}}


&{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. }}

[edit] Inline Labels

normal roll with inline labels

If you want to include description or explanations to what individual dice or modifiers represent in you rolls, you can introduce inline labels, by using use square brackets in the macro. For example, /roll 2d10+5[Fire Damage] + 3d6[Ice Damage]. Inline labels works both with "normal" rolls and inline rolls. See the earlier gifs for inline label examples in inline rolls.

When these comments are applied directly after a die roll they show up as tool-tips on the dice:

/roll 2d10+5[Fire Damage] + 3d6[Ice Damage]

This is especially useful if a roll contains multiple variables and you want to look up what number comes from what attribute.

Example of inline label use in a roll template, from the Mythic D6 sheet.

Examples:

You can even use sheet attributes in labels. Especially useful if the name of the stat can be customized by the user, so the corresponding label should change to reflect the name.
Example:

/r @{selected|customskill1}d6[@{selected|customskill1name}] + @{selected|str}[str]

[edit] Tricks

[edit] Related Pages