Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Help with a rolltemplate macro

1763643113
Kadus
Pro
Sheet Author
Hello, Sorry to bother you, but I need some help creating a macro for a custom character sheet of a french role-playing game. I don’t know how to make a macro that asks for the type of roll (an attribute roll using dice from d4 to d12, or a d20 roll), similar to how D&D 5e asks for advantage or disadvantage, with a different rolltemplate depending on whether it’s a normal or “advantage-style” roll. Thanks in advance!
1763648832

Edited 1763648871
Hi, the macro would require a query.&nbsp; <a href="https://wiki.roll20.net/Roll_Query" rel="nofollow">https://wiki.roll20.net/Roll_Query</a> Here's a simple example using default rolltemplate: e.g. &amp;{template:default} {{name=Any Dice Roll}} {{Roll=[[?{How Many Sides?| d4 | d6 | d8 | d10 | d12 | d20} ]] }}
1763649908

Edited 1763651889
Wait. I just noticed the second part of your question. About making it a different roll template based on type of roll.&nbsp; <a href="https://wiki.roll20.net/Building_Character_Sheets/Roll_Templates" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets/Roll_Templates</a> The way I would go about this is by rolling all of the dice every time and only showing the result you want with roll template logic - so 1 giant template with parts of it shown. make the dice type query select a number as a roll (rather than a dice), so you can use template logic. And use the $[[0]], $[[1]]... helpers to call out specific rolls based on the query) So,the macro would be &amp;{template:YourTemplateName} &nbsp;[[ d4]] [[ d6 ]] [[d8]] [[d10]] [[d12]] [[d20]]&nbsp; [[ ?{Dice Type| d4, 1 | d6, 2 | d8, 3 | d10, 4 | d12, 5 | d20, 6} ]]&nbsp; {{d4=$[[0]] }}&nbsp; {{d6=$[[1]] }}&nbsp; {{d8=$[[2]] }}&nbsp; {{d10=$[[3]] }}&nbsp; {{d12=$[[4]] }}&nbsp; {{d20=$[[5]] }} {{DiceType=$[[6]] }} Then you can call the specific parts of the roll in the template like this Put {{DiceType}} in the name part of the template in the html Then wrap all the individual dice rolls in something like this: {{#rollTotal DiceType 1}} &lt;div&gt; {{d4}} &lt;/div&gt; {{/rollTotal DiceType 1}} {{#rollTotal DiceType 2}} &lt;div&gt; {{d6}} &lt;/div&gt; {{/rollTotal DiceType 2}} ---- I did the above quickly between work, so shout if you have questions. But 100% should be doable.
1763655097
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
No need to roll everything, but this is going to require a custom roll template. What's the exact rule for the advantage?
1763672439
Kadus
Pro
Sheet Author
Hello, I finally found the solution after several hours, inspired by the Adventures in Middle-earth character sheet. &lt;select name="attr_rtype" style="display: none;"&gt; &lt;option value="&amp;#123;&amp;#123;harmonique=1&amp;#125;&amp;#125;"&gt;Toujours Harmonique&lt;/option&gt; &lt;option value="&amp;#123;&amp;#123;merveilleux=1&amp;#125;&amp;#125;"&gt;Toujours Merveilleux&lt;/option&gt; &lt;option value="{{query=1}} ?{Type de jet?|Harmonique,&amp;#123&amp;#123harmonique=1|Merveilleux,&amp;#123&amp;#123merveilleux=1}" selected&gt; Demander à chaque jet&lt;/option&gt; &lt;/select&gt; and macro : &amp;{template:harmonique} {{title=@{character_name}}} {{carac=Nuit}} @{rtype}}} {{r_harmonique=[[floor(1d@{nuit}cs@{nuit}cf1/4)]]}} {{r_merveilleux=[[floor(1d20cs20cf1/4)]]}} {{difficulte=[[?{Difficulté ?|0}]]}}" class=" label-btn"&gt;Âme&lt;/button&gt; Now I’ve run into another problem — I’d like to be able to check if the roll is a critical and if the number of successes (result / 4) exceeds the difficulty. That’s the new wall I’ve hit ^^ Here’s the rolltemplate: &lt;rolltemplate class="sheet-rolltemplate-harmonique"&gt; &lt;div class="sheet-rolltemplate-harmonique-background sheet-rolltemplate-harmonique-center"&gt; {{#title}} &lt;div class="sheet-rolltemplate-harmonique-center sheet-rolltemplate-harmonique-header"&gt; {{title}} &lt;/div&gt; {{/title}} &lt;div class="sheet-rolltemplate-harmonique-center sheet-rolltemplate-harmonique-subheader"&gt; {{carac}} {{#harmonique}} &lt;span&gt; - Harmonique&lt;/span&gt; {{/harmonique}} {{#merveilleux}} &lt;span&gt; - Merveilleux&lt;/span&gt; {{/merveilleux}} &lt;/div&gt; &lt;div class="sheet-rolltemplate-harmonique-center sheet-rolltemplate-harmonique-result"&gt; {{#harmonique}} &lt;span&gt;{{r_harmonique}} succès&lt;/span&gt; &lt;!-- Critiques/Fumbles --&gt; {{#rollCrit() r_harmonique}} &lt;div class="sheet-rolltemplate-critique-succes"&gt;Envolée !&lt;/div&gt; {{/rollCrit() r_harmonique}} {{#rollFumble() r_harmonique}} &lt;div class="sheet-rolltemplate-critique-echec"&gt;Fausse note&lt;/div&gt; {{/rollFumble() r_harmonique}} &lt;!-- Comparaison difficulté (toujours affichée) --&gt; {{#rollGreater() r_harmonique difficulte}} &lt;div class="sheet-rolltemplate-reussite"&gt;Réussite !&lt;/div&gt; {{/rollGreater() r_harmonique difficulte}} {{#rollTotal() r_harmonique difficulte}} &lt;div class="sheet-rolltemplate-reussite"&gt;Réussite !&lt;/div&gt; {{/rollTotal() r_harmonique difficulte}} {{#rollLess() r_harmonique difficulte}} &lt;div class="sheet-rolltemplate-echec"&gt;Presque !&lt;/div&gt; {{/rollLess() r_harmonique difficulte}} {{/harmonique}} {{#merveilleux}} &lt;span&gt;{{r_merveilleux}} succès&lt;/span&gt; &lt;!-- Critiques/Fumbles --&gt; {{#rollCrit() r_merveilleux}} &lt;div class="sheet-rolltemplate-critique-succes"&gt;Merveille&lt;/div&gt; {{/rollCrit() r_merveilleux}} {{#rollFumble() r_merveilleux}} &lt;div class="sheet-rolltemplate-critique-echec"&gt;Incident magique&lt;/div&gt; {{/rollFumble() r_merveilleux}} &lt;!-- Comparaison difficulté (toujours affichée) --&gt; {{#rollGreater() r_merveilleux difficulte}} &lt;div class="sheet-rolltemplate-reussite"&gt;Réussite !&lt;/div&gt; {{/rollGreater() r_merveilleux difficulte}} {{#rollTotal() r_merveilleux difficulte}} &lt;div class="sheet-rolltemplate-reussite"&gt;Réussite !&lt;/div&gt; {{/rollTotal() r_merveilleux difficulte}} {{#rollLess() r_merveilleux difficulte}} &lt;div class="sheet-rolltemplate-echec"&gt;Presque !&lt;/div&gt; {{/rollLess() r_merveilleux difficulte}} {{/merveilleux}} &lt;/div&gt; &lt;!-- Variables cachées --&gt; &lt;div style="display: none;"&gt; {{difficulte}} &lt;/div&gt; &lt;/div&gt; &lt;/rolltemplate&gt; This character sheet is complicated ^^; thank you&nbsp;