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

Create a scale of dice success ?

1676106979
Maïlare
Pro
Sheet Author
API Scripter
Hello, Is it possible to create (with a rolltemplate, sheetworker or API) a scale to evaluate the success of the dice roll ? I explain : In my RPG System (D100 system) the success of the roll is evaluate as this : - Normal success : below competence and above 20 - Exceptional sucess : between 11 and 20 - Fabulous success : between 6 and 10 - Critical success : below or equal 5 - Critical fail : above or equal 96 How can I make this in my sheet script or in API ?
1676111569
GiGs
Pro
Sheet Author
API Scripter
You can do this with all of the methids you ask about - usually a rolltemplate or the API. You can also do it with Custom Roll parsing (a sheet worker), but it'll most likely be displayed with a rolltemplate so you might do it that way. Look at the logic helpers in rolltemplates: <a href="https://wiki.roll20.net/Building_Character_Sheets/Roll_Templates#Helper_Functions" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets/Roll_Templates#Helper_Functions</a>
1676200610
Maïlare
Pro
Sheet Author
API Scripter
GiGs said: You can do this with all of the methids you ask about - usually a rolltemplate or the API. You can also do it with Custom Roll parsing (a sheet worker), but it'll most likely be displayed with a rolltemplate so you might do it that way. Look at the logic helpers in rolltemplates: <a href="https://wiki.roll20.net/Building_Character_Sheets/Roll_Templates#Helper_Functions" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets/Roll_Templates#Helper_Functions</a> Hello GiGs, I have tried to made this with roll template, but it does'nt work. It's my code : &lt; rolltemplate class = "sheet-rolltemplate-enyllion" &gt; &nbsp; &nbsp; &lt; table &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ #perso }} &nbsp; &nbsp; &nbsp; &nbsp; {{ #familier }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "name" &gt;&lt; b &gt; {{ perso }} &lt;/ b &gt;&lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt;&lt; td class= "famname" &gt;&lt; b &gt; {{ familier }} &lt;/ b &gt;&lt;/ td &gt;&lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt;&lt; td &gt;&lt; hr / &gt;&lt;/ td &gt;&lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ /familier }} &nbsp; &nbsp; &nbsp; &nbsp; {{ /perso }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt;&lt; th &gt; {{ name }} &lt;/ th &gt;&lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ #Roll }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "tcat" &gt; Carac : {{ Carac }} &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; br &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "tcat" &gt; Jet : {{ Roll }} &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; br &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollGreater () Roll Carac }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "diceresult" style= "color:red;" &gt; Échec &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollGreater () Roll Carac }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollLess () Roll Carac }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "diceresult" style= "color:green;" &gt; Réussite &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollLess () Roll Carac }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollWasCrit () Roll Carac }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "diceresult" style= "color:red;" &gt; Echec critique ! &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollWasCrit () Roll Carac }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollWasFumble () Roll Carac }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "diceresult" style= "color:green;" &gt;&lt; b &gt; Reussite critique ! &lt;/ b &gt;&lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollWasFumble () Roll Carac }} &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ /Roll }} &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt;&lt; th &gt; {{ description }} &lt;/ th &gt;&lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; br &gt; &nbsp; &nbsp; &lt;/ table &gt; &lt;/ rolltemplate &gt; When I roll if it's a fumble or a crit, the message in the chat is only that of rollLess or rollGreater ans it's never display the message of rollWasCrit or rollWasFumble. Have you an idea why ?
1676211310

Edited 1676243023
GiGs
Pro
Sheet Author
API Scripter
It's hard to say without seeing the macro for the roll. Can you post that?
1676211655
Maïlare
Pro
Sheet Author
API Scripter
GiGs said: It's hard to sey without seeing the macro for the roll. Can you post that? Yes it's possible. The code is an inline roll in my character sheet : &lt; button &nbsp; type = "roll" style = " margin-left:30px;" title = "Force" name = "roll_FO" value = "&amp;{template:enyllion} {{perso=@{Name &amp;#125; }} {{name=Force}} {{Carac=[[@{FO}+?{Modificateur|0}]]}} &nbsp;{{Roll=[[1D100]]}}" &gt;&lt;/ button &gt;
1676247919

Edited 1676247935
GiGs
Pro
Sheet Author
API Scripter
Everything looks constructed properly there, except this should not work: {{perso=@{Name&amp;#125; }} Replace it as {{perso=@{Name} }} Never replace parts of an attribute call with html entities - they break the attribute call. That aside, I can't see anything wrong with your macro or rolltemplate. I may have to try it myself. That said, I don't think I have ever used the rollWasCrit or rollWasFumble helpers, I always use rollGreater, rollLess, rollTotal with the explicit number stated.
1676250152

Edited 1676259148
GiGs
Pro
Sheet Author
API Scripter
Also how are you setting the critical. By default, they will only occur on 1 and 100. If you want them to have a wider range, you have to include that in the code, like &lt; button &nbsp; type = "roll" style = " margin-left:30px;" title = "Force" name = "roll_FO" value = "&amp;{template:enyllion} {{perso=@{Name &amp;#125; }} {{name=Force}} {{Carac=[[@{FO}+?{Modificateur|0}]]}} &nbsp;{{Roll=[[1D100cs&lt;5cf&gt;96]]}}" &gt;&lt;/ button &gt;
Look at scriptcards API/MOD as well.&nbsp;&nbsp;
1676468305
Maïlare
Pro
Sheet Author
API Scripter
GiGs said: Everything looks constructed properly there, except this should not work: {{perso=@{Name&amp;#125; }} Replace it as {{perso=@{Name} }} Never replace parts of an attribute call with html entities - they break the attribute call. That aside, I can't see anything wrong with your macro or rolltemplate. I may have to try it myself. That said, I don't think I have ever used the rollWasCrit or rollWasFumble helpers, I always use rollGreater, rollLess, rollTotal with the explicit number stated. Hello, It works with the html replacement of brackets, but it don't work without. It's because I have make my formulas as this.
1676468475
Maïlare
Pro
Sheet Author
API Scripter
GiGs said: Also how are you setting the critical. By default, they will only occur on 1 and 100. If you want them to have a wider range, you have to include that in the code, like &lt; button &nbsp; type = "roll" style = " margin-left:30px;" title = "Force" name = "roll_FO" value = "&amp;{template:enyllion} {{perso=@{Name &amp;#125; }} {{name=Force}} {{Carac=[[@{FO}+?{Modificateur|0}]]}} &nbsp;{{Roll=[[1D100cs&lt;5cf&gt;96]]}}" &gt;&lt;/ button &gt; I have find an error in my code, I have wrote "Roll Carac Carac" in place of "Roll Carac" and now it works. Here is the code if can help anyone &lt; rolltemplate class = "sheet-rolltemplate-enyllion" &gt; &nbsp; &nbsp; &lt; table &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ #perso }} &nbsp; &nbsp; &nbsp; &nbsp; {{ #familier }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "name" &gt;&lt; b &gt; {{ perso }} &lt;/ b &gt;&lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt;&lt; td class= "famname" &gt;&lt; b &gt; {{ familier }} &lt;/ b &gt;&lt;/ td &gt;&lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt;&lt; td &gt;&lt; hr / &gt;&lt;/ td &gt;&lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ /familier }} &nbsp; &nbsp; &nbsp; &nbsp; {{ /perso }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt;&lt; th &gt; {{ name }} &lt;/ th &gt;&lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ #Roll }} &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "tcat" &gt; Carac : {{ Carac }} &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; br &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "tcat" &gt; Jet : {{ Roll }} &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; br &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollGreater () Roll 95 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "diceresult" style= "color:red; font-size: large;" &gt; Echec critique ! &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollGreater () Roll 95 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollBetween () Roll Carac 95 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "diceresult" style= "color:red; font-size: large;" &gt; Échec &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollBetween () Roll Carac 95 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollBetween () Roll 21 Carac }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "diceresult" style= "color:green; font-size: large;" &gt; Réussite &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollBetween () Roll 21 Carac }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollBetween () Roll 11 20 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "diceresult" style= "color:green; font-size: large;" &gt; Réussite exceptionnelle &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollBetween () Roll 11 20 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollBetween () Roll 6 10 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "diceresult" style= "color:green; font-size: large;" &gt; Réussite Fabuleuse &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollBetween () Roll 6 10 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ #rollLess () Roll 6 }} &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; td class= "diceresult" style= "color:green; font-size: large;" &gt; Réussite critique &lt;/ td &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {{ /rollLess () Roll 6 }} &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; {{ /Roll }} &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; tr &gt;&lt; th &gt; {{ description }} &lt;/ th &gt;&lt;/ tr &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt; br &gt; &nbsp; &nbsp; &lt;/ table &gt; &lt;/ rolltemplate &gt;
1676507902
GiGs
Pro
Sheet Author
API Scripter
Maïlare said: GiGs said: Everything looks constructed properly there, except this should not work: {{perso=@{Name&amp;#125; }} Replace it as {{perso=@{Name} }} Never replace parts of an attribute call with html entities - they break the attribute call. That aside, I can't see anything wrong with your macro or rolltemplate. I may have to try it myself. That said, I don't think I have ever used the rollWasCrit or rollWasFumble helpers, I always use rollGreater, rollLess, rollTotal with the explicit number stated. Hello, It works with the html replacement of brackets, but it don't work without. It's because I have make my formulas as this. That is weird. Notice you have @{FO} later that works, so I'm at a loss to explain why @{name} requires it - normally html entities completely break attribute calls. But if it works, and the rest of your code now works, might as well stick with it :)
1676566798
Maïlare
Pro
Sheet Author
API Scripter
GiGs said: Maïlare said: GiGs said: Everything looks constructed properly there, except this should not work: {{perso=@{Name&amp;#125; }} Replace it as {{perso=@{Name} }} Never replace parts of an attribute call with html entities - they break the attribute call. That aside, I can't see anything wrong with your macro or rolltemplate. I may have to try it myself. That said, I don't think I have ever used the rollWasCrit or rollWasFumble helpers, I always use rollGreater, rollLess, rollTotal with the explicit number stated. Hello, It works with the html replacement of brackets, but it don't work without. It's because I have make my formulas as this. That is weird. Notice you have @{FO} later that works, so I'm at a loss to explain why @{name} requires it - normally html entities completely break attribute calls. But if it works, and the rest of your code now works, might as well stick with it :) I think it's because after @{name}, it have the double bracket and it's to avoid conflicts.
1676607142
GiGs
Pro
Sheet Author
API Scripter
That shouldn't matter, you can have triple brackets there. Due to Roll20's order of operations, the attribute call @{name} will be processed before the {{ }} are seen, and so roll20 won't see thriple brackets. I always put a space there anyway to break them up - a little superstition :)