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

Comparing rolls on a character sheet's roll

Hello there ! I am currently trying to adapt a character sheet system of a friend of mine on roll20 but I'm having some issues. Basically, what I want is to make a roll on a d30, then compairing the result with the characters attribute. If it is lower, then the roll is a success. Currently I'm running with this :          < label > Force  </ label >< input   type = "text"   name = 'attr_force'   class = 'sheet-short' >          < button   type = 'roll'   name = 'roll_testattack'   value = '&{template:default} {{name=Force - @{character_name}}} {{result=[[1d30 < @{force}]]}}' ></ button > Which is working, the button does the roll and displays 0 or 1 for failure and success. But I want to be able to : display the roll, then compair it and display "Success" or "Failure" depending on the result. Any tips on how to archieve this ?
1628050515
GiGs
Pro
Sheet Author
API Scripter
You'll need to look into custom roll templates to achieve this. They are described on the wiki.
1628051619

Edited 1628051728
Oosh
Sheet Author
API Scripter
There's a few ways to do this. First, the ugliest and simplest, change the roll to: [[ {[[1d30]]+0d0,0d0}>15 ]] successes Then you can recall the 1d30 roll with $[[0]] and display it somewhere else. If you want to make it looks nice, you'll need to write your own roll template. This can display different sections depending on your outcome. Something like: < rolltemplate   class= "sheet-test" >      < div   class= "sheet-outer" >          < div   class= "sheet-rollname" >              {{ rollname }}          </ div >          < div   class= "sheet-dieroll" >              {{ dieroll }}          </ div >          {{ #outcome }}              {{ #^ rollLess ()  outcome   0 }}              < div   class= "sheet-success" >                 The roll was successful!              </ div >              {{ / ^ rollLess ()  outcome   0 }}              {{ #rollLess ()  outcome   0 }}              < div   class= "sheet-failure" >                 The roll was a failure!              </ div >              {{ /rollLess () outcome 0 }}          {{ /outcome }}      </ div > </ rolltemplate > And your roll button becomes something like: &{template:test} {{rollname=1d30 vs @{force}}} {{outcome=[[ {[[1d30]]+0d0,0d0} - @{force} ]]}} {{dieroll=$[[0]]}} You'd then need to pretty it up with some CSS, labels, titles etc. Finally, changing the roll button to an action button and writing some javascript will allow you to do whatever you want to the roll via the new startRoll() function. You can do almost anything you'd like here including grabbing attributes & input from the user before assembling your template. If you don't want to create roll templates but know some JS, you could put whatever you want in the default template this way.
1628061186
GiGs
Pro
Sheet Author
API Scripter
Oh yes, I completely forgot about the action button method.