# What to Show in rollTemplates

Roll20’s dice mechanics are extremely flexible and can do a lot, but there are some dice rolls you simply cannot represent with them. But with the Logic Helpers from last post, you can do more some things wqhich aren’t immediately obvious. There are some complex rolls you still can’t do, and for those you’ll need Critical Roll Parsing.

In this post, we’ll look at how you might approach some dice rolls generally regarded as not possible, explain some failings of this system, and talk about one problem that often crops up which is both a misunderstanding and a bug.

## Critical or Fumble From Multiple Dice

In roll20, you can check if a die criticals or fubles and you can change the critical and fumble range. But this applies per die. There’s no way to say a roll is a critical if 2d6 roll a 12, or 3d6 roll a 3, etc. But you can do that kind of thing with Logic Helpers. But you have to construct the roll properly.

Lets you your success roll is 2d6+ skill level. Ad a 2 is a fumble, and 12 is a critical. Here’s one way you might build that roll.

```.wp-block-code {
border: 0;
}

.wp-block-code > span {
display: block;
overflow: auto;
}

.shcb-language {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
position: absolute;
width: 1px;
word-wrap: normal;
word-break: normal;
}

.hljs {
box-sizing: border-box;
}

.hljs.shcb-code-table {
display: table;
width: 100%;
}

.hljs.shcb-code-table > .shcb-loc {
color: inherit;
display: table-row;
width: 100%;
}

.hljs.shcb-code-table .shcb-loc > span {
display: table-cell;
}

.wp-block-code code.hljs:not(.shcb-wrap-lines) {
white-space: pre;
}

.wp-block-code code.hljs.shcb-wrap-lines {
white-space: pre-wrap;
}

.hljs.shcb-line-numbers {
border-spacing: 0;
counter-reset: line;
}

.hljs.shcb-line-numbers > .shcb-loc {
counter-increment: line;
}

.hljs.shcb-line-numbers .shcb-loc > span {
}

.hljs.shcb-line-numbers .shcb-loc::before {
border-right: 1px solid #ddd;
content: counter(line);
display: table-cell;
text-align: right;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 1%;
}
`&{template:2d6} {{roll=[[2d6 + ?{Skill|0}]]}} {{target=[[?{Difficulty|0}]]}} {{critical=[[12+?{Skill}]]}} fumble=[[2+?{Skill}]]}} `Code language: Markdown (markdown)```

Every entry here is required. If you omit any of them, the rolltemplate won’t work. It is possible to account for missing items, but you won’t be able to caulcuate whatever depends on it, and the rolltemplate gets much more complex.

``````<rolltemplate class="sheet-rolltemplate-2d6">
<span>{{roll}}=
{{#rollTotal() roll critical}}Critical{{/rollTotal() roll critical}}
{{#^rollTotal() roll critical}}
{{#rollTotal() roll fumble}}Fumble{{/rollTotal() roll fumble}}
{{#^rollTotal() roll fumble}}
{{#rollLess() roll target}}Failure{{#rollLess() roll target}}
{{#^rollLess() roll target}}Success{{#^rollLess() roll target}}
{{/^rollTotal() roll fumble}}
{{/^rollTotal() roll critical}}
</span>
</rolltemplate>```Code language: HTML, XML (xml)```

This is a complex roll – hopefully the nesting will help you figure out what is going on. First we check if the roll is a critical. A natural roll of 12 is also 12 + skill modifier.

Then we check if the roll equals a fumble – again a natural roll of 2 equals 2 + skill.

If none of them are true, we test if the roll equals or exceeds the difficlty of the roll – we do this with rollLess and NOT rollRollLess. Nesting means everything above is true (or false, if using NOT).

Notice: the target, critical, and fumble scores are nt printed out. They are calculated in the roll and then passed to the rolltemplate. You can’t perform any calculations in a rolltemplate – they must be done first.

This roll assumes natural 2 and 12 are more important than skill. You could imagine a system where 2 is a fumble only if the roll is also a failure, and 12 is a critical if the roll succeeded. That can be done, but not without some duplication.

``````<rolltemplate class="sheet-rolltemplate-2d6">
<span>{{roll}}=
{{#rollTotal() roll critical}}
{{#rollLess() roll target}}Failure{{/rollLess() roll target}}
{{#^rollLess() roll target}}Critical{{/^rollLess() roll target}}
{{/rollTotal() roll critical}}
{{#^rollTotal() roll critical}}
{{#rollTotal() roll fumble}}
{{#rollLess() roll target}}Fumble{{/rollLess() roll target}}
{{#^rollLess() roll target}}Success{{/^rollLess() roll target}}
{{/rollTotal() roll fumble}}
{{#^rollTotal() roll fumble}}
{{#rollLess() roll target}}Success{{/rollLess() roll target}}
{{#^rollLess() roll target}}Success{{/^rollLess() roll target}}
{{/^rollTotal() roll fumble}}
{{/^rollTotal() roll critical}}
</span>
</rolltemplate>```Code language: HTML, XML (xml)```

## Savage Worlds Dice

In savage worlds, you have an ability die, typically 1d4, 1d6, 1d8, 1d10, or 1d12, but it can explode if you get the maximum value. You also roll a wild die, 1d6, and take the highest of the two. The roll is a fumble if both the skill and wild dice roll a 1. This is tricky to do normally, but can be done with Logic Helpers (also with Custom Roll Parsing, but that series isn’t written yet).

It’s easiest to split the skil ldie and thw wild die into to separate tolls, like this:

``&{template:sw} {{skill=[[ 1d?{die Size?|4|6|8|10|12}!!cf0]]}} {{wild=[[1d6!!]]}}`Code language: Markdown (markdown)`

Now you need to test which of the two dice is higher, and report that value.

``````<rolltemplate class="sheet-rolltemplate-sw">
<span>Roll=
{{#^rollLess() wild skill}}{{wild}}{{/^rollLess() wild skill}}
{{#rollLess() wild skill}}{{skill}}{{/rollLess() wild skill}}
</span>
</rolltemplate>```Code language: HTML, XML (xml)```

This will show only the highest of two dice. Notice the way it uses the NOT operator (^).

But you also need to check if both dice equal 1.

``````<rolltemplate class="sheet-rolltemplate-sw">
<span>Roll=
{{#^rollLess() wild skill}}{{wild}}{{/^rollLess() wild skill}}
{{#rollLess() wild skill}}{{skill}}{{/rollLess() wild skill}}
{{#rollTotal() wild 1}}
{{#rollTotal() skill 1}}
<span class="sheet-fumble"> (Fumble)</span>
{{/rollTotal() skill 1}}
{{/rollTotal() wild 1}}
</span>
</rolltemplate>```Code language: HTML, XML (xml)```

This addes the word (Fumble) after the roll, and places it in a span so you can apply styling to it (maybe making that word stand out).

It’s not too complex in this arrangement. But there are problems. Both dice will be rolled, and only one displayed – this causes issues if using 3d dice.

Also, when both dice are equal, it always shows the wild dice. That might cause issues with mouse over text. If you want to alter that, I’ll leave that as an exercise for the reader.

## Rolemaster Dice

Some rolls are simply not possible to represent using roll20 dice mechanics, even with rolltemplate logic helpers. The problem here is being able to explode in both directions. To resolve this, we can engage in a bit of a hack, using Reusing Rolls.

A rolemaster roll is described as follows:

• Roll d100. If that original roll is 96-100, add an open-ended 1d100 which explodes on 96-00.
• If the original roll is 01-05, subtract an open-ended 1d100 which explodes on 96-00.
• Finally, add your ability score to the total.

Roll20 die cannot explode downwards, but we can show or hide parts of text. Let’s start with a roll like this:

``&{template:rm} [[ [[1d00!>96 + ?{score|50}]] - 1d100!>96]] {{roll1=\$[[0]] }} {{roll2=\$[[1]] }} {{fumble=[[5+?{score} ]] ))`Code language: Markdown (markdown)`

With this roll we setup a normal exploding die, a d100 + skill. But if, and only if, this roll is 5 or less, we subtract another exploding d100.

Now if the roll is in the fumble range, we use the second dice total. If if its not, we use the first dice roll (which includes rolls that explode upwards and non-exploding rolls).

``````<rolltemplate class="sheet-rolltemplate-rm">
<span>Roll=
{{#rollLess() roll1 fumble}}{{roll2}}{{/rollLess() roll1 fumble}}
{{#^rollLess() roll1 fumble}}{{roll1}}{{/^rollLess() roll1 fumble}}
</span>
</rolltemplate>```Code language: HTML, XML (xml)```

The rolltemplate is fairly simple. This demonstarteds that the hard part is analysing the roll and coming up with a template call that matches the output you want.

In this temoplate, roll1 is simply not shown if you are rolling down, and roll1 is not shown if you are. That leads us to one of the major problems with rolltemplates.

## 3D Dice

There is a nifty feature of roll20 (most VTT’s have something similar) which rolls your dice on the battlmap. If you trigger a roll with 2d6, you will see two 6-sided dice roll satisfying across the table.

The problem is when you are hiding some dice, as in these templates. The 3d feature was written separately from the rolltemplate feature, and does not know the contents of a rolltemplate. So if you roll 1d100 for your skill roll, and 1d100 for the rare case of down rolls, and usually hide that second die, the 3d feature doesn;t know that and always rolls both dice.

This causes confusion when people see a character sheet is rolling more dice than it should. The only real solution is to ignore the 3d or switch that feature off when usign a character sheet that does this. And its a very commonly used feature, so you’ll usually have to switch 3d off.

Series Navigation<< Using Logic In a RolltemplateButtons in Rolltemplates >>

This site uses Akismet to reduce spam. Learn how your comment data is processed.