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

possibility to simplify part of a rolltemplate with handlebar templates?

1689765851
Matthew C
Pro
Sheet Author
Hey everyone, I am not an expert with html and have never used handlebars or whatnot, but I have the following code                 {{ #rollGreater () number 1 }}                     {{ #rollTotal () computed :: roll1 1 }}                         {{ #rollTotal () computed :: removal1 0 }} < div class= "sheet-template-inner-container sheet-template-fail" > {{ /rollTotal () computed::removal1 0 }}                         {{ #rollTotal () computed :: removal1 1 }} < div class= "sheet-template-inner-container sheet-template-removal" > {{ /rollTotal () computed::removal1 1 }}                         < span class= "sheet-template-roll sheet-template-numbers" > {{ computed :: roll1 }} < span class= "sheet-template-roll-backing-fail" > 0 </ span ></ span >                     {{ /rollTotal () computed::roll1 1 }}                     {{ #rollBetween () computed :: roll1 2 9 }}                         {{ #rollTotal () computed :: removal1 0 }} < div class= "sheet-template-inner-container" > {{ /rollTotal () computed::removal1 0 }}                         {{ #rollTotal () computed :: removal1 1 }} < div class= "sheet-template-inner-container sheet-template-removal" > {{ /rollTotal () computed::removal1 1 }}                         < span class= "sheet-template-roll sheet-template-numbers" > {{ computed :: roll1 }} < span class= "sheet-template-roll-backing" > 0 </ span ></ span >                     {{ /rollBetween () computed::roll1 2 9 }}                     {{ #rollTotal () computed :: roll1 10 }}                         {{ #rollTotal () computed :: removal1 0 }} < div class= "sheet-template-inner-container sheet-template-crit" > {{ /rollTotal () computed::removal1 0 }}                         {{ #rollTotal () computed :: removal1 1 }} < div class= "sheet-template-inner-container sheet-template-removal" > {{ /rollTotal () computed::removal1 1 }}                         < span class= "sheet-template-roll sheet-template-numbers" > {{ computed :: roll1 }} < span class= "sheet-template-roll-backing-crit" > 0 </ span ></ span >                     {{ /rollTotal () computed::roll1 10 }}                     < div class= "sheet-template-column" >                         < span class= "sheet-template-bonus sheet-template-numbers" >< span class= "sheet-template-bonus-plus" > + </ span > {{ bonus }} </ span >                         < span class= "sheet-template-bonus sheet-template-numbers" >< span class= "sheet-template-bonus-minus" > - </ span > {{ penalty }} </ span >                     </ div >                     < span class= "sheet-template-roll-fix sheet-template-numbers" > {{ computed :: result1 }} < span class= "sheet-template-result-backing" > location_searching </ span ></ span >                     </ div >                 {{ /rollGreater () number 1 }} and this continues with ALL the numbers going up to 25 (mainly because I have to do this all manually, so I just used 25 as my limit...but is there any way to do this better? With the sheetworker side I had some help and got it a hell of a lot shorter, but not sure if that is possible here
1689769398

Edited 1689769461
GiGs
Pro
Sheet Author
API Scripter
I do use handlebars as a way to streamling code creation, but for rolltemplates I have to put them inside a block which says, "don't touch this" because they mess up the result because they are already using handlebars syntax. If you're doing a massively repeating section like that (from 1-25), I would look at the logic and see if it can be simplified*, and if not, look into using Custom Roll Parsing which is frequently a way to make rolltemplats massively simpler a9dn avoid arbitrary limits like 25). *Look at the roll and see how much can be front-loaded into the roll button, for example, so it;s done before the rolltemplate sees it.
1689840472
Matthew C
Pro
Sheet Author
Hey thanks for the reply, I saw that they used Mustache (like handlebars I guess?) so I was worried they wouldn't be able to I am making this for a system I am co developing and one of the things is the fact that each dice itself is very important and needs to be visible (especially because a roll template can usually deal with up to like 99% of everything, so you need to be able to see the 1% times it doesn't function as intended maybe you have a better idea than me, but basically it works like this custom roll parsing to determine the actual amount of dice being rolled using loops etc. and then once everything is calculated it sends it to the template the template then shows each dice roll separately with a different backing for each dice depending on a natural roll of 1, 2-9 or 10 (red ,black, green). Everything works just fine and I could have the players roll X*1d10 without worries, but I have yet to find a good way to show X*1d10 in the template without preloading them manually as shown above. the only reason I chose 25 is because it would be extremely rare to get above 15, but for those cases I do not want a chance of just enough or just too little so I went with 25 (if you go above it shows nothing but an error saying to use less than 25) The reason the template is so complex is because it actually checks if X number of dice were rolled or not as a side note I also noticed that you cannot add variable colours in the :root css for rolltemplates either, which is a pain XD but either way, thank you for the information, even though it just confirmed my fears XD
1689843191

Edited 1689843327
GiGs
Pro
Sheet Author
API Scripter
I'd need more specific details to build a working copy, but that sounds doable. I created a working CRP example here: <a href="https://app.roll20.net/forum/permalink/11549443/" rel="nofollow">https://app.roll20.net/forum/permalink/11549443/</a> (Funny, there are three CRP questions alll at once.) The code above does calculate the number of dice (look for a-d), and outputs each individual die result for display purposes as well as showing the successes. If you want to show a different backing for each die, you;d do that with CSS after the roll has been made, but the die value (which contains a class for the dice image) can be done in the sheet worker. This part wold be changed for that: roll: dice ,
1689845084

Edited 1689849722
GiGs
Pro
Sheet Author
API Scripter
In the linked code, you'd likely need to replace a lot, but the main focus would be after startRoll, and a starting point might look something like this: startRoll ( `&amp;{template:special} {{roll=[[ ${ dice } d10]]}}` , diceroll =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // figuring out how to extract dice rolls is tricky, but it's helpful to interrogate console.log({diceroll}) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const dice = diceroll . results . roll . dice ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // map does something to each die in turn, and returns a new array. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let display = dice . map ( die =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( die === 1 ) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output = die ; // do whatever happens when die is 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else if ( die === 10 ) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output = die ; // do whatever happens when die is 10 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output = die ; // do whatever happens when die is 2-9 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return output ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // in finishroll, you can save computed values - the hidden alternate values in your roll's keys. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finishRoll ( diceroll . rollId ,{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; roll:display . join ( ' ' ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; });
1689865342
Matthew C
Pro
Sheet Author
hey, thanks for the reply, I will try and show you the super complex code being used XD (I won't even attempt to show all the CSS as the way you have to do css with roll templates makes it insane) &nbsp; &nbsp; on ( 'clicked:repeating_war:damageroll' , ( eventInfo ) =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; let rowid = eventInfo . sourceAttribute . split ( '_' )[ 2 ]; &nbsp; &nbsp; &nbsp; &nbsp; let info = {}; &nbsp; &nbsp; &nbsp; &nbsp; info [ "name" ] = "@{character_name}'s Wounding Roll" ; &nbsp; &nbsp; &nbsp; &nbsp; info [ "action" ] = "(@{repeating_war_" + rowid + "_active_dice} + ?{Bonus Wound Dice|0})" ; &nbsp; &nbsp; &nbsp; &nbsp; info [ "bonus" ] = "?{Bonus|0} [Bonus] + @{repeating_war_" + rowid + "_activeaction} [Damage] " ; &nbsp; &nbsp; &nbsp; &nbsp; info [ "effectone" ] = "repeating_war_" + rowid + "_activeeffectone" ; &nbsp; &nbsp; &nbsp; &nbsp; info [ "effect" ] = "repeating_war_" + rowid + "_effect" ; &nbsp; &nbsp; &nbsp; &nbsp; info [ "luck" ] = "@{repeating_war_" + rowid + "_activeluck}" ; &nbsp; &nbsp; &nbsp; &nbsp; info [ "relentless" ] = "@{repeating_war_" + rowid + "_activerelentless}" ; &nbsp; &nbsp; &nbsp; &nbsp; info [ "threshold" ] = "@{repeating_war_" + rowid + "_activethreshold}" ; &nbsp; &nbsp; &nbsp; &nbsp; info [ "thresholdinfo" ] = "@{repeating_war_" + rowid + "_threshold}" ; &nbsp; &nbsp; &nbsp; &nbsp; info [ "type" ] = 2 ; &nbsp; &nbsp; &nbsp; &nbsp; getAttrs ([ "repeating_war_" + rowid + "_active_type" , "repeating_war_" + rowid + "_honed" , "repeating_war_" + rowid + "_muted" ], function ( values ) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; info [ "honed" ] = "(?{Number of Honed Dice|0})" ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; info [ "muted" ] = "(?{Number of Muted Dice|0})" ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; roll ( info ); &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; }); Start with the damage roll button to get the relevant info &nbsp; &nbsp; function roll ( info ) { &nbsp; &nbsp; &nbsp; &nbsp; let name = info [ "name" ]; &nbsp; &nbsp; &nbsp; &nbsp; let action = info [ "action" ]; &nbsp; &nbsp; &nbsp; &nbsp; let bonusinfo = info [ "bonus" ]; &nbsp; &nbsp; &nbsp; &nbsp; let effectbase = info [ "effect" ]; &nbsp; &nbsp; &nbsp; &nbsp; let effectone = info [ "effectone" ]; &nbsp; &nbsp; &nbsp; &nbsp; let luck = info [ "luck" ]; &nbsp; &nbsp; &nbsp; &nbsp; let relentless = info [ "relentless" ]; &nbsp; &nbsp; &nbsp; &nbsp; let threshold = info [ "threshold" ]; &nbsp; &nbsp; &nbsp; &nbsp; let thresholdinfo = info [ "thresholdinfo" ]; &nbsp; &nbsp; &nbsp; &nbsp; let type = info [ "type" ]; &nbsp; &nbsp; &nbsp; &nbsp; let honed = info [ "honed" ]; &nbsp; &nbsp; &nbsp; &nbsp; let muted = info [ "muted" ] + " + " + info [ "relentless" ]; &nbsp; &nbsp; &nbsp; &nbsp; let total = action + "+" + honed + "+" + muted + "+" + relentless ; &nbsp; &nbsp; &nbsp; &nbsp; total = total &gt; 25 ? 26 : total ; &nbsp; &nbsp; &nbsp; &nbsp; let endRoll = `&amp;{template:actionroll} {{name= ${ name } }} {{number=[[ ${ total } +1]]}} {{roll=[[( ${ total } )d10]]}} {{type=[[ ${ type } ]]}} {{threshold=[[ ${ threshold } ]]}} {{character=@{character_name}}} {{bonus=[[ ${ bonusinfo } ]]}} {{penalty=[[?{Penalty|0} [Penalty]]]}} {{honed=[[ ${ honed } ]]}} {{muted=[[ ${ muted } ]]}} {{thresholdinfo= ${ thresholdinfo } }} {{luck=[[ ${ luck } ]]}} {{effectbase=@{ ${ effectbase } }}} {{effectone=@{ ${ effectone } }}} {{effect=[[0]]}} {{crit=[[0]]}} {{fail=[[0]]}} {{iscritorfail=[[0]]}}` ; &nbsp; &nbsp; &nbsp; &nbsp; const numArr = [... Array ( 25 ). keys ()]. map ( n =&gt; n + 1 ); &nbsp; &nbsp; &nbsp; &nbsp; numArr . forEach ( n =&gt; endRoll += `{{roll ${ n } =[[0]]}} ` ); &nbsp; &nbsp; &nbsp; &nbsp; numArr . forEach ( n =&gt; endRoll += `{{result ${ n } =[[0]]}} ` ); &nbsp; &nbsp; &nbsp; &nbsp; numArr . forEach ( n =&gt; endRoll += `{{removal ${ n } =[[0]]}} ` ); &nbsp; &nbsp; &nbsp; &nbsp; numArr . forEach ( n =&gt; console . log ( n )); &nbsp; &nbsp; &nbsp; &nbsp; let effect = 0 ; &nbsp; &nbsp; &nbsp; &nbsp; let isCritOrFail = 0 ; &nbsp; &nbsp; &nbsp; &nbsp; getAttrs ([ effectone ], function ( values ) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; effect = values [ effectone ] === "" ? 0 : 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}); &nbsp; &nbsp; &nbsp; &nbsp; startRoll ( endRoll , ( results ) =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const computedObj = {}; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let number = results . results . number . result ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let bonus = results . results . bonus . result ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let penalty = results . results . penalty . result ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let luck = results . results . luck . result ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let crit = 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let fail = 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let test = results . results . roll . dice ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let ordered = results . results . roll . dice . sort (( a , b ) =&gt; a - b ); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let startremoval = results . results . honed . result ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let end = results . results . muted . result ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let endremoval = number - end ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; results . results . roll . dice . forEach (( dieResult , i ) =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( i &gt; 25 ) return ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startremoval &gt; 0 ? computedObj [ `removal ${ i + 1 } ` ] = startremoval &gt;= i + 1 ? 1 : 0 : computedObj [ `removal ${ i + 1 } ` ] = 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &gt; 0 ? computedObj [ `removal ${ i + 1 } ` ] += i + 1 &gt;= endremoval ? 1 : 0 : computedObj [ `removal ${ i + 1 } ` ] += 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `roll ${ i + 1 } ` ] = dieResult ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `result ${ i + 1 } ` ] = dieResult + results . results . bonus . result - results . results . penalty . result ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `removal ${ i + 1 } ` ] === 0 ? crit += dieResult === 10 ? 1 : 0 : 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `removal ${ i + 1 } ` ] === 0 ? fail += dieResult === 1 ? 1 : 0 : 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console . log ( computedObj ); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isCritOrFail = crit &gt; 0 ? 1 : 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isCritOrFail = isCritOrFail &gt; 0 ? fail &gt; luck ? 0 : 1 : fail &gt; luck ? - 1 : 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `effect` ] = effect ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `crit` ] = crit ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `fail` ] = fail - luck ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `iscritorfail` ] = isCritOrFail ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finishRoll ( results . rollId , computedObj ); &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; }; then the actual dice roller to get the info, had some help from Scott C to make this a lot better already
1689865429
Matthew C
Pro
Sheet Author
&nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; {{ #rollTotal () computed :: iscritorfail 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-container sheet-template-container-crit" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: crit 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-header-crit" &gt; Good Luck &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-columned-crit" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 1 }} &lt; span style= "text-align: center;" &gt; Reduce Wounds taken by 1. &lt;/ span &gt; {{ /rollTotal () computed::type 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 2 }} &lt; span style= "text-align: center;" &gt; Increase Wounds dealt by 1. &lt;/ span &gt; {{ /rollTotal () computed::type 2 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 3 }} &lt; span style= "text-align: center;" &gt; Increase Wounds restored by 1. &lt;/ span &gt; {{ /rollTotal () computed::type 3 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::crit 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollGreater () computed :: crit 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-header-crit" &gt; Extreme Good Luck &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-columned-crit" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 1 }} &lt; span style= "text-align: center;" &gt; Reduce Wounds taken by 2. &lt;/ span &gt; {{ /rollTotal () computed::type 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 2 }} &lt; span style= "text-align: center;" &gt; Increase Wounds dealt by 2. &lt;/ span &gt; {{ /rollTotal () computed::type 2 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 3 }} &lt; span style= "text-align: center;" &gt; Increase Wounds restored by 2. &lt;/ span &gt; {{ /rollTotal () computed::type 3 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollGreater () computed::crit 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; {{ /rollTotal () computed::iscritorfail 1 }} &nbsp; &nbsp; {{ #rollTotal () computed :: iscritorfail -1 }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-container sheet-template-container-fail" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: fail 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-header-fail" &gt; Bad Luck &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-columned-fail" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 1 }} &lt; span style= "text-align: center;" &gt; Increase Wounds taken by 1. &lt;/ span &gt; {{ /rollTotal () computed::type 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 2 }} &lt; span style= "text-align: center;" &gt; Decrease Wounds dealt by 1. &lt;/ span &gt; {{ /rollTotal () computed::type 2 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 3 }} &lt; span style= "text-align: center;" &gt; Decrease Wounds restored by 1. &lt;/ span &gt; {{ /rollTotal () computed::type 3 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::fail 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollGreater () computed :: fail 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-header-fail" &gt; Extreme Bad Luck &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-columned-fail" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 1 }} &lt; span style= "text-align: center;" &gt; Increase Wounds taken by 2. &lt;/ span &gt; {{ /rollTotal () computed::type 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 2 }} &lt; span style= "text-align: center;" &gt; Decrease Wounds dealt by 2. &lt;/ span &gt; {{ /rollTotal () computed::type 2 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: type 3 }} &lt; span style= "text-align: center;" &gt; Decrease Wounds restored by 2. &lt;/ span &gt; {{ /rollTotal () computed::type 3 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollGreater () computed::fail 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; {{ /rollTotal () computed::iscritorfail -1 }} &nbsp; &nbsp; {{ #rollGreater () threshold 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-container" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-header" &gt; Threshold Effect &lt; span class= "sheet-template-span-small" &gt; ( Threshold: {{ threshold }} ) &lt;/ span &gt;&lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-columned" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span style= "text-align: center;" &gt; {{ thresholdinfo }} &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; {{ /rollGreater () threshold 0 }} &nbsp; &nbsp; {{ #effectbase }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-container" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-header" &gt; Primary Effect &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-columned" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span style= "text-align: center;" &gt; {{ effectbase }} &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; {{ /effectbase }} &nbsp; &nbsp; {{ #rollGreater () computed :: effect 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-container" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-header" &gt; Effect Runes &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-columned" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span style= "text-align: center;" &gt; {{ effectone }} &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; {{ /rollGreater () computed::effect 0 }} &lt;/ rolltemplate &gt; and then the roll template (only showing number 1, since the other 24 are identical so useless to add for now) and this is how it looks <a href="https://imgur.com/PQ9TchS" rel="nofollow">https://imgur.com/PQ9TchS</a>
1689865807
Matthew C
Pro
Sheet Author
&lt; rolltemplate class = "sheet-rolltemplate-actionroll" &gt; &nbsp; &nbsp; &lt; div class= "sheet-template-container" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-header" &gt; {{ name }} &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ #primary }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-column" style= "text-align: center;" &gt; {{ primary }} &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ /primary }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-span sheet-template-wrap" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollGreater () number 26 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-span sheet-template-wrap" &gt; Template only works with up to 25 dice &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollGreater () number 26 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #^ rollGreater () number 26 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollGreater () number 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: roll1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container sheet-template-fail" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container sheet-template-removal" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-roll sheet-template-numbers" &gt; {{ computed :: roll1 }} &lt; span class= "sheet-template-roll-backing-fail" &gt; 0 &lt;/ span &gt;&lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::roll1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollBetween () computed :: roll1 2 9 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container sheet-template-removal" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-roll sheet-template-numbers" &gt; {{ computed :: roll1 }} &lt; span class= "sheet-template-roll-backing" &gt; 0 &lt;/ span &gt;&lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollBetween () computed::roll1 2 9 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: roll1 10 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container sheet-template-crit" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container sheet-template-removal" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-roll sheet-template-numbers" &gt; {{ computed :: roll1 }} &lt; span class= "sheet-template-roll-backing-crit" &gt; 0 &lt;/ span &gt;&lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::roll1 10 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-column" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-bonus sheet-template-numbers" &gt;&lt; span class= "sheet-template-bonus-plus" &gt; + &lt;/ span &gt; {{ bonus }} &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-bonus sheet-template-numbers" &gt;&lt; span class= "sheet-template-bonus-minus" &gt; - &lt;/ span &gt; {{ penalty }} &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-roll-fix sheet-template-numbers" &gt; {{ computed :: result1 }} &lt; span class= "sheet-template-result-backing" &gt; location_searching &lt;/ span &gt;&lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollGreater () number 1 }} &nbsp; &nbsp; {{ / ^ rollGreater () number 26 }} &nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; &lt;/ div &gt; this is supposed to go above the last post
1689896302
GiGs
Pro
Sheet Author
API Scripter
You're using CRP already? Here's the standard question I always ask before I can help with a complex roll: Describe this roll as if you were describing it to a player in your game, at the table, with no Roll20 involved. Don't describe how your roll20 roll and rolltemplate work. Describe this without any reference to Roll20. Then, and only then, tell me which roll20 attributes are involved.
1689924296
Matthew C
Pro
Sheet Author
Okidoki Player makes an attack using their Destruction WAR stats: 2 Damage, 4 Wound Dice, 2 Relentless, 2 Honed Dice, 1 Luck they roll 10d10 (4 from Wound Dice, 4 from Relentless and 2 from Honed): 1,1,1,3,7,8,9,9,10,10 Now they subtract the lowest 2 Dice because of the Honed Dice and the Highest 2 Dice because of Relentless (for reference, 1 relentless equals 1 Wound Dice and 1 Muted Wound Dice) Leaving: 1,3,7,8,9,9 Now, if there are any 1s but no 10s it is bad luck (or good luck if vice versa), however the attack has Luck 1, meaning it ignores a single 1 for Luck (still kept for potential damage) And add their Damage to EACH result giving: 3,5,9,10,11,11 GM specifies that this causes 4 Wounds by comparing each result to the target's Mitigation (behind the screen) meaning: Enemy takes 4 Wounds Any attack effect with Threshold of 4 or lower is applied Any attack effect for a successful attack is applied this is what the roll template looks like: <a href="https://imgur.com/a/gM7rU5F" rel="nofollow">https://imgur.com/a/gM7rU5F</a> the template actually shows if it is good/bad luck, but I programmed it in to ignore it in cases like this :p
1689924793
Matthew C
Pro
Sheet Author
So now to the code: The CRP catches the entire roll and calculates the number of d10 to roll based on everything that increases number of dice and then sorts that array from lowest to highest then runs through a loop for each of the die results to move it into a new array for the roll amount, an array for the result of that roll (so roll + bonuses-penalties) and an array with a flag whether it should be removed or not furthermore it checks for criticals and critical fails (using the removal flag and luck statistic for filtering) finally after all that magic it sends it to the roll template which is the part that takes up around 900 lines of code (and that is without wrapping to new lines on absurdly long lines and putting small lines between the open and closing handlebars, instead of separate lines)
1689941688

Edited 1689942047
GiGs
Pro
Sheet Author
API Scripter
That is an extremely complex mechanic. It should be possible to simplify it with CRP, but every other method will be clunky at best if its even possible (see existing code, lol). What do you check each die for? I notice this bit in your rolltemplate: const numArr = [...Array(25).keys()].map(n =&gt; n + 1); &nbsp; &nbsp; &nbsp; &nbsp; numArr.forEach(n =&gt; endRoll += `{{roll${n}=[[0]]}} `); &nbsp; &nbsp; &nbsp; &nbsp; numArr.forEach(n =&gt; endRoll += `{{result${n}=[[0]]}} `); &nbsp; &nbsp; &nbsp; &nbsp; numArr.forEach(n =&gt; endRoll += `{{removal${n}=[[0]]}} `); &nbsp; &nbsp; &nbsp; &nbsp; numArr.forEach(n =&gt; console.log(n)); What do you need to know those properties for each die for? Everything you do in the rollTemplate should be doable in the CRP worker. You just print final results that you need printing to the rollTemplate, no calculation or analysis needs to be done there when using CRP.
1689942481
GiGs
Pro
Sheet Author
API Scripter
Let's look at what you need the CRP to do. Looking at the image, you need the number of dice sorted by final result, and for each die, 3 results: base roll, modifier (which it looks like it maybe be a positive and negative?), and total. It wll be possible to produce the entire CSS string foir each die in the CRP code, and probably the whole string too so you are sending just a single string that is then formatted by the Rolltemplate's CRP. Remember rolltemplates are designed to recieve strings. The inline roll / rolltemplate helpers are an optional feature. The dice greyed out are the highest dice. Why is that?
1689944739
Matthew C
Pro
Sheet Author
ok, let's see piece by piece greyed out dice are both the highest and the lowest and that is because of the Honed Dice (remove the lowest dice) and the Muted Dice (remove the highest) not all attacks have both (actually most attacks are much simpler, but for the rolltemplate I am taking the more complex tasks it will need to be able to do the map at the top is used for each individual dice roll amount WITHOUT any modifiers each individual dice roll amount WITH modifiers a simple 0/1 flag whether I want the result greyed out (for use with the muted/honed dice) this last one is optional, but it makes it much faster to read which ones are ignored. The reason I greyed them out instead of flat removed them is for the exceptions where the template is incapable of doing it correctly, this way you can still see all of the rolls So that is what those are all used for results . results . roll . dice . forEach (( dieResult , i ) =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( i &gt; 25 ) return ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startremoval &gt; 0 ? computedObj [ `removal ${ i + 1 } ` ] = startremoval &gt;= i + 1 ? 1 : 0 : computedObj [ `removal ${ i + 1 } ` ] = 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &gt; 0 ? computedObj [ `removal ${ i + 1 } ` ] += i + 1 &gt;= endremoval ? 1 : 0 : computedObj [ `removal ${ i + 1 } ` ] += 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `roll ${ i + 1 } ` ] = dieResult ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `result ${ i + 1 } ` ] = dieResult + results . results . bonus . result - results . results . penalty . result ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `removal ${ i + 1 } ` ] === 0 ? crit += dieResult === 10 ? 1 : 0 : 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computedObj [ `removal ${ i + 1 } ` ] === 0 ? fail += dieResult === 1 ? 1 : 0 : 0 ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); in this part of the code you can see that I run through each of the dice individually and save them to one or more of the mapped arrays. I do need to rewrite the top part of this as it is confusing, but the lines that srtart with startremoval and end are used to grey out the lowest and highest rolls depending on the number of dice needing to be removed and the last two lines (which I could also simplify :p) are used to check if I have any crits or fails, by ignoring the ones that are greyed out, as we do not use those
1689945030
Matthew C
Pro
Sheet Author
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollGreater () number 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: roll1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container sheet-template-fail" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container sheet-template-removal" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-roll sheet-template-numbers" &gt; {{ computed :: roll1 }} &lt; span class= "sheet-template-roll-backing-fail" &gt; 0 &lt;/ span &gt;&lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::roll1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollBetween () computed :: roll1 2 9 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container sheet-template-removal" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-roll sheet-template-numbers" &gt; {{ computed :: roll1 }} &lt; span class= "sheet-template-roll-backing" &gt; 0 &lt;/ span &gt;&lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollBetween () computed::roll1 2 9 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: roll1 10 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container sheet-template-crit" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 0 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollTotal () computed :: removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-inner-container sheet-template-removal" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::removal1 1 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-roll sheet-template-numbers" &gt; {{ computed :: roll1 }} &lt; span class= "sheet-template-roll-backing-crit" &gt; 0 &lt;/ span &gt;&lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollTotal () computed::roll1 10 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; div class= "sheet-template-column" &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-bonus sheet-template-numbers" &gt;&lt; span class= "sheet-template-bonus-plus" &gt; + &lt;/ span &gt; {{ bonus }} &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-bonus sheet-template-numbers" &gt;&lt; span class= "sheet-template-bonus-minus" &gt; - &lt;/ span &gt; {{ penalty }} &lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; span class= "sheet-template-roll-fix sheet-template-numbers" &gt; {{ computed :: result1 }} &lt; span class= "sheet-template-result-backing" &gt; location_searching &lt;/ span &gt;&lt;/ span &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ div &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollGreater () number 1 }} &nbsp; and this is basically the only important part of the rolltemplate as the rest is fluff, but this has to be manually done 25+ times, so adjustments are a pain and easy to break the code with a mistake basically it first checks whether or not the roll is a 1, 2-9 or 10 (so roll without modifiers) for crit and fail, as I colour the border and dice to make it easier to see and then in each of those categories I need to check if it needs to be greyed out or whether to use the non greyed out class, so it is quite simple and each of these uses greater than number X, so if number (which is ALL dice rolled +1 (the +1 is so that I am not using 0)) is a 4, than it would show greater than 1,2,3 and greater than 4+ would all be ignored
1689995464

Edited 1689995925
GiGs
Pro
Sheet Author
API Scripter
Matthew C said: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and each of these uses greater than number X, so if number (which is ALL dice rolled +1 (the +1 is so that I am not using 0)) is a 4, than it would show greater than 1,2,3 and greater than 4+ would all be ignored The numbers in your screenshot are much bigger than 4. This is a variable number?
1690014277
Matthew C
Pro
Sheet Author
the number 4 is how many dice are shown and is indeed variable &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; info [ "action" ] = "(@{repeating_war_" + rowid + "_active_dice} + ?{Bonus Wound Dice|0})" ; &nbsp; &nbsp; &nbsp; &nbsp; info [ "relentless" ] = "@{repeating_war_" + rowid + "_activerelentless}" ; &nbsp; &nbsp; &nbsp; &nbsp; getAttrs ([ "repeating_war_" + rowid + "_active_type" , "repeating_war_" + rowid + "_honed" , "repeating_war_" + rowid + "_muted" ], function ( values ) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; info [ "honed" ] = "(?{Number of Honed Dice|0})" ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; info [ "muted" ] = "(?{Number of Muted Dice|0})" ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; roll ( info ); &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; let total = action + "+" + honed + "+" + muted + "+" + relentless ; total = total &gt; 25 ? 26 : total ; let endRoll = `...... {{number=[[ ${ total } +1]]}}...... the above shows where they are from