https://wiki.roll20.net/index.php?title=Special:RecentChangesLinked&feed=atom&target=Dice_ReferenceRoll20 Wiki - Changes related to "Dice Reference" [en]2024-03-19T05:29:54ZRelated changesMediaWiki 1.20.3https://wiki.roll20.net/index.php?title=Complete_Guide_to_Macros_%26_Rolls&diff=33750&oldid=33726Complete Guide to Macros & Rolls2024-03-18T06:43:34Z<p><span dir="auto"><span class="autocomment">External Tools: </span> </span></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 06:43, 18 March 2024</td>
</tr><tr><td colspan='4' style='text-align: center;' class='diff-multi'>(One intermediate revision by one user not shown)</td></tr><tr><td colspan="2" class="diff-lineno">Line 546:</td>
<td colspan="2" class="diff-lineno">Line 546:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>==External Tools==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>==External Tools==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>* '''[<del class="diffchange diffchange-inline">https://app.roll20.net/forum/permalink/10515058/ </del>Roll20 Macros - a Visual Studio Code Extension]''' by [[Andreas J.]]</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>* '''[<ins class="diffchange diffchange-inline">[VS_Code#Roll20_Syntax_Highlight|</ins>Roll20 Macros - a Visual Studio Code Extension<ins class="diffchange diffchange-inline">]</ins>]''' by [[Andreas J.]]</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>** syntax highlight and autocomplete help for roll20 macro writing<del class="diffchange diffchange-inline">, makes </del>reading, writing, & identifying mistakes in macros easier</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>** syntax highlight and autocomplete help for roll20 macro writing<ins class="diffchange diffchange-inline">. Makes </ins>reading, writing, & identifying mistakes in macros easier <ins class="diffchange diffchange-inline">with color-coding matching brackets and more. </ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>* [[Stylus]]</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>* [[Stylus]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>** Can be used for some advanced macro tricks, like [[Hidden Rolls]]</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>** Can be used for some advanced macro tricks, like [[Hidden Rolls]]</div></td></tr>
<!-- diff cache key roll20-mw_:diff:version:1.11a:oldid:33726:newid:33750 -->
</table>1223200https://wiki.roll20.net/index.php?title=Reusing_Rolls&diff=33747&oldid=33729Reusing Rolls2024-03-18T06:24:44Z<p>link to related article</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 06:24, 18 March 2024</td>
</tr><tr><td colspan='4' style='text-align: center;' class='diff-multi'>(One intermediate revision by one user not shown)</td></tr><tr><td colspan="2" class="diff-lineno">Line 62:</td>
<td colspan="2" class="diff-lineno">Line 62:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></pre></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></pre></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>In this case, index 0 will find the result of 1d20, index 1 will include the <del class="diffchange diffchange-inline">"</del>str_mod<del class="diffchange diffchange-inline">"</del>, and index 2 will subtract the <del class="diffchange diffchange-inline">"</del>str_mod<del class="diffchange diffchange-inline">" </del>from the previous value and add the 6.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>In this case, <ins class="diffchange diffchange-inline"><code></ins>index 0<ins class="diffchange diffchange-inline"></code> </ins>will find the result of <ins class="diffchange diffchange-inline"><code></ins>1d20<ins class="diffchange diffchange-inline"></code></ins>, <ins class="diffchange diffchange-inline"><code></ins>index 1<ins class="diffchange diffchange-inline"></code> </ins>will include the <ins class="diffchange diffchange-inline"><code></ins>str_mod<ins class="diffchange diffchange-inline"></code></ins>, and <ins class="diffchange diffchange-inline"><code></ins>index 2<ins class="diffchange diffchange-inline"></code> </ins>will subtract the <ins class="diffchange diffchange-inline"><code></ins>str_mod<ins class="diffchange diffchange-inline"></code> </ins>from the previous value and add the 6.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>'''What's it allow us to do though?'''</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>'''What's it allow us to do though?'''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>There's several new things this allows the community to do that were previously locked behind access to the API.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>There's several new things this allows the community to do that were previously locked behind access to the <ins class="diffchange diffchange-inline">Mods(</ins>API<ins class="diffchange diffchange-inline">)</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>'''Character Sheets'''</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>'''Character Sheets'''</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 90:</td>
<td colspan="2" class="diff-lineno">Line 90:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[File:Reuse-rolls-rows-ex1.png]]</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[File:Reuse-rolls-rows-ex1.png]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>The problem here is it shows the Total first. I <del class="diffchange diffchange-inline">havent </del>found a way to use the $[[ ]] syntax to access a roll that others are nested inside, like Total here? Has anyone else figured out how to do that?</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>The problem here is it shows the Total first. I <ins class="diffchange diffchange-inline">haven't </ins>found a way to use the <ins class="diffchange diffchange-inline"><code></ins>$[[ ]]<ins class="diffchange diffchange-inline"></code> </ins>syntax to access a roll that others are nested inside, like Total here? Has anyone else figured out how to do that?</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>My trick is: there is way to reorder the rows within the template, if you <del class="diffchange diffchange-inline">dont </del>mind using numbers as the row titles:</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>My trick is: there is way to reorder the rows within the template, if you <ins class="diffchange diffchange-inline">don't </ins>mind using numbers as the row titles:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><pre style="overflow:hidden;white-space:pre-wrap"></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><pre style="overflow:hidden;white-space:pre-wrap"></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>&{template:default} {{name=Stats}} {{total=[[ [[4d6kh3]] + [[4d6kh3]] + [[4d6kh3]] + [[4d6kh3]] + [[4d6kh3]] +[[4d6kh3]] ]] }} {{1=$[[0]]}} {{2=$[[1]]}} {{3=$[[2]]}} {{4=$[[3]]}} {{5=$[[4]]}} {{6=$[[5]]}}</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>&{template:default} {{name=Stats}} {{total=[[ [[4d6kh3]] + [[4d6kh3]] + [[4d6kh3]] + [[4d6kh3]] + [[4d6kh3]] +[[4d6kh3]] ]] }} {{1=$[[0]]}} {{2=$[[1]]}} {{3=$[[2]]}} {{4=$[[3]]}} {{5=$[[4]]}} {{6=$[[5]]}}</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 101:</td>
<td colspan="2" class="diff-lineno">Line 101:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[File:Reuse-rolls-rows-ex2.png]]</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[File:Reuse-rolls-rows-ex2.png]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>It turns out that if your default template row name (the part before the =) is just a number, it gets sorted before any text entries, and in numerical ascending order.  </div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>It turns out that if your default template row name (the part before the <ins class="diffchange diffchange-inline"><code></ins>=<ins class="diffchange diffchange-inline"></code></ins>) is just a number, it gets sorted before any text entries, and in numerical ascending order.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>If you want text labels, you put them after the <code>=</code>, like so:</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>If you want text labels, you put them after the <code>=</code>, like so:</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 110:</td>
<td colspan="2" class="diff-lineno">Line 110:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[File:Reuse-rolls-rows-ex3.png]]</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[File:Reuse-rolls-rows-ex3.png]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>So there you go, another implementation of the new 'feature' (or is it a bug), and another undocumentated feature (or is it a bug?) of <del class="diffchange diffchange-inline">rolltemplates</del>.  </div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>So there you go, another implementation of the new 'feature' (or is it a bug), and another undocumentated feature (or is it a bug?) of <ins class="diffchange diffchange-inline">[[Roll Templates]]</ins>.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Note: negative numbers are sorted just like text, they don't change position. This trick works only for numbers 0 and higher. They <del class="diffchange diffchange-inline">dont </del>have to be consecutive. It also doesnt work for [[Inline Rolls|inline rolls]].</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline">'''</ins>Note:<ins class="diffchange diffchange-inline">''' </ins>negative numbers are sorted just like text, they don't change position. <ins class="diffchange diffchange-inline">'''</ins>This trick works only for numbers 0 and higher.<ins class="diffchange diffchange-inline">''' </ins>They <ins class="diffchange diffchange-inline">don't </ins>have to be consecutive. It also doesnt work for [[Inline Rolls|inline rolls]].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[File:Reuse-rolls-rows-ex3.png]]</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[File:Reuse-rolls-rows-ex3.png]]</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 123:</td>
<td colspan="2" class="diff-lineno">Line 123:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>'''Note:''' This is specifically for [[BCS|character sheet designers]], but it's an implementation of an earlier trick from this thread that is only documented here.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>'''Note:''' This is specifically for [[BCS|character sheet designers]], but it's an implementation of an earlier trick from this thread that is only documented here.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Here's another nifty and counter-intuitive thing about <del class="diffchange diffchange-inline">Resuing </del>rolls:</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Here's another nifty and counter-intuitive thing about <ins class="diffchange diffchange-inline">Reusing </ins>rolls:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>When using them in a rolltemplate, you can use them with logic functions, like <code>rollGreater()</code>.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>When using them in a rolltemplate, you can use them with logic functions, like <code>rollGreater()</code>.</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 160:</td>
<td colspan="2" class="diff-lineno">Line 160:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></pre></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></pre></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>The outer nesting is treated as the last one in the line, so <code><nowiki>$[[0]]</nowiki></code> gives you the result of the first inline roll in the deepest layer of the roll while <code><nowiki>$[[1]]</nowiki></code> gives you the same result as the complete roll. If the nested 1d8 results in a 4, the outer roll becomes 1d8r4 so it rerolls any results of 4. The <code><nowiki>$[[0]]</nowiki></code> will show an output of 4 and the inline roll will have a result of any number between 1 and 8, except for 4.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>The outer nesting is treated as the last one in the line, so <code><nowiki>$[[0]]</nowiki></code> gives you the result of the first inline roll in the deepest layer of the roll while <code><nowiki>$[[1]]</nowiki></code> gives you the same result as the complete roll. If the nested <ins class="diffchange diffchange-inline"><code></ins>1d8<ins class="diffchange diffchange-inline"></code> </ins>results in a <ins class="diffchange diffchange-inline"><code></ins>4<ins class="diffchange diffchange-inline"></code></ins>, the outer roll becomes <ins class="diffchange diffchange-inline"><code></ins>1d8r4<ins class="diffchange diffchange-inline"></code> </ins>so it rerolls any results of <ins class="diffchange diffchange-inline"><code></ins>4<ins class="diffchange diffchange-inline"></code></ins>. The <code><nowiki>$[[0]]</nowiki></code> will show an output of <ins class="diffchange diffchange-inline"><code></ins>4<ins class="diffchange diffchange-inline"></code> </ins>and the inline roll will have a result of any number between <ins class="diffchange diffchange-inline"><code></ins>1<ins class="diffchange diffchange-inline"></code> </ins>and <ins class="diffchange diffchange-inline"><code></ins>8<ins class="diffchange diffchange-inline"></code></ins>, except for <ins class="diffchange diffchange-inline"><code></ins>4<ins class="diffchange diffchange-inline"></code></ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>I haven't yet tested multiple nested layers or multiple inline rolls within the main roll, but I suspect preventing more than 2 rolls from matching would get quite complex, if at all possible.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>I haven't yet tested multiple nested layers or multiple inline rolls within the main roll, but I suspect preventing more than 2 rolls from matching would get quite complex, if at all possible.</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 267:</td>
<td colspan="2" class="diff-lineno">Line 267:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>==See Also==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>==See Also==</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">* [[Toggleable template fields]]</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>* [[Inline Rolls]]</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>* [[Inline Rolls]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>* '''[[Complete Guide to Macros & Rolls]]'''</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>* '''[[Complete Guide to Macros & Rolls]]'''</div></td></tr>
</table>1223200