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 .
×

rollBetween checking total of roll, not first inline roll

1604983458

Edited 1604983579
< button   class = "invisible-button skill"   type = "roll"   value = "&{template:custom} {{title=@{CharName}}}  {{skill=Bribery}} {{normal=[[ 1d10 + @{COOL} + @{Bribery} ]]}} {{crit=[[ 10 + 1d10 + @{COOL} + @{Bribery} ]] }}  {{fumble=[[ 1 - 1d10 + @{COOL} + @{Bribery}]]}}"   name = "roll_Bribery" > Bribery </ button > < rolltemplate   class = "sheet-rolltemplate-custom" >    < div   class = "sheet-container sheet-color-{{color}}" >      < div   class = "sheet-header" >        < div   class = "sheet-title" > {{title}} </ div >       {{#subtitle}} < div   class = "sheet-subtitle" > {{subtitle}} </ div > {{/subtitle}}      </ div >      < div   class = "sheet-content" >              {{#rollWasCrit() normal}}        < div   class = "sheet-desc" > Crit: {{crit}} </ div >       {{/rollWasCrit() normal}}       {{#rollBetween() normal 2 9}}        < div   class = "sheet-desc" > {{normal}} </ div >       {{/rollBetween() normal 2 9}}       {{#rollWasFumble() normal}}        < div   class = "sheet-desc" > Fumble: {{fumble}} </ div >       {{/rollWasFumble() normal}}        < div   class = "sheet-desc" > xxx </ div >       {{#allprops()}}        < div > {{key}} </ div >< div > {{value}} </ div >       {{/allprops()}}      </ div >    </ div > </ rolltemplate > Why does  {{#rollBetween() normal 2 9}}  calculate based on the total value of  normal  instead of the value of the first inline roll?
1604983836
Finderski
Pro
Sheet Author
Compendium Curator
It looks at the total value, because normal = the total value. If you want to have it look at just the result on the d10, then you'll need to do the work around to re-use rolls...For that, we'll need someone like GiGs to explain how to do it (or search for the forums for it), because I haven't used it yet and couldn't tell you off-hand how to do it.
I figured out I have the wrong definition of inline roll. I accomplished what I wanted with...       {{#^rollWasCrit() normal}}         {{#^rollWasFumble() normal}}            < div   class = "sheet-desc" > {{normal}} </ div >         {{/^rollWasFumble() normal}}       {{/^rollWasCrit() normal}}
Finderski said: It looks at the total value, because normal = the total value. If you want to have it look at just the result on the d10, then you'll need to do the work around to re-use rolls...For that, we'll need someone like GiGs to explain how to do it (or search for the forums for it), because I haven't used it yet and couldn't tell you off-hand how to do it. <a href="https://wiki.roll20.net/Roll_Templates#Helper_Functions" rel="nofollow">https://wiki.roll20.net/Roll_Templates#Helper_Functions</a> This page says " Note: All helper functions will only check the first inline roll found in a property. "&nbsp; The first inline roll of my "normal" property is&nbsp; 1d10 &nbsp;, not the total value of "normal"
1605031005
GiGs
Pro
Sheet Author
API Scripter
Brian S. said: The first inline roll of my "normal" property is&nbsp; 1d10 &nbsp;, not the total value of "normal" That's not quite true. In roll20 "inline roll" has a specific meaning. It's the result of whatever is inside brackets like these [[ ]]. They are in fact usually referred to as inline roll brackets. So with this: &nbsp;{{normal=[[&nbsp;1d10&nbsp;+&nbsp;@{COOL}&nbsp;+&nbsp;@{Bribery}&nbsp;]]}}&nbsp; normal is the result of the calculation between the [[ ]] brackets, the total of 1d10 + @{COOL} + @{Bribery}.
1605031391

Edited 1605031485
Finderski
Pro
Sheet Author
Compendium Curator
Brian S. said: The first inline roll of my "normal" property is&nbsp; 1d10 &nbsp;, not the total value of "normal" An inline roll is everything within the brackets: [[ ]] In your formula, everything, not just the d10, is within the brackets. [[ 1d10 + @{COOL} + @{Bribery} ]] I'm not certain how they'd handle things if you had inline rolls within inline rolls, what's considered first? the outer inline roll, or the inner inline roll? I don't know, but you could maybe try: [[ [[1d10]] + @{COOL} + @{Bribery} ]] If that doesn't work, there is the nesting thing, which I believe would be something like: &amp;{template:custom} {{title=@{CharName}}} {{skill=Bribery}} [[ [[1d10]] + @{COOL} + @{Bribery} ]] {{normalcheck=$[[1]]}} {{normal=$[[0]]}} {{crit=[[ 10 + 1d10 + @{COOL} + @{Bribery} ]] }} {{fumble=[[ 1 - 1d10 + @{COOL} + @{Bribery}]]}} You'd need to look at normal check for the formatting instead of normal, because that would have the single roll you want to evaluate. &nbsp; As mentioned above, I've never used this trick, so I may have some of the mechanics wrong and I may have the $[[1]] and $[[0]] backwards. But there's more information on this trick here:&nbsp; <a href="https://wiki.roll20.net/Reusing_Rolls" rel="nofollow">https://wiki.roll20.net/Reusing_Rolls</a>
1605031460

Edited 1605031546
GiGs
Pro
Sheet Author
API Scripter
If you want to get just the d10 roll, you can use the Reusing Rolls trick (see the wiki). Change your button value to this &nbsp;value="&amp;{template:custom}&nbsp;{{title=@{CharName}}}&nbsp;[[ [[1d10]] +&nbsp;@{COOL}&nbsp;+&nbsp;@{Bribery}&nbsp;]]&nbsp;{{skill=Bribery}} {{roll=$[[0]]}} {{normal=$[[1]]}}&nbsp;{{crit=[[&nbsp;10&nbsp;+&nbsp;1d10&nbsp;+&nbsp;@{COOL}&nbsp;+&nbsp;@{Bribery}&nbsp;]]&nbsp;}}&nbsp;{{fumble=[[&nbsp;1&nbsp;-&nbsp;1d10&nbsp;+&nbsp;@{COOL}&nbsp;+&nbsp;@{Bribery}]]}}" This adds a special roll that isnt in {{ }} brackets, so it doesnt get printed out or sent to the rolltemplate. But you can use $[[0]] to get the innermost inline roll from it, and $[[1]] to get the total. You can then use rollbetween like &nbsp;{{#rollBetween()&nbsp;roll 2&nbsp;9}}&nbsp; since #roll is just the roll. I was about to point out another way to do it, using nested rollwasCrit and rollwasFumble, and not operator, but you figured it out :) Note that the reusing rolls method is undocumented and may stop working in the future, whereas the not operator and nested crit/fumble method are documented, so it's safer longterm to go with that approach.
1605031595
Finderski
Pro
Sheet Author
Compendium Curator
You're better off listening to GiGs' solution... :)
1605031620
GiGs
Pro
Sheet Author
API Scripter
Ninja'd by Finderski :)
GiGs said: Brian S. said: The first inline roll of my "normal" property is&nbsp; 1d10 &nbsp;, not the total value of "normal" That's not quite true. In roll20 "inline roll" has a specific meaning. It's the result of whatever is inside brackets like these [[ ]]. They are in fact usually referred to as inline roll brackets. So with this: &nbsp;{{normal=[[&nbsp;1d10&nbsp;+&nbsp;@{COOL}&nbsp;+&nbsp;@{Bribery}&nbsp;]]}}&nbsp; normal is the result of the calculation between the [[ ]] brackets, the total of 1d10 + @{COOL} + @{Bribery}. But other functions like&nbsp;rollWasCrit() use just the value of the 1d10. It is inconsistent.&nbsp;
1605130520
GiGs
Pro
Sheet Author
API Scripter
Its not inconsistent, because they are checking different things. Roll20 has a feature where it can show the result of a critical or a fumble, and for those it has to look at the dice roll and ignore anything else. This feature works independently of whether you are using an inline roll like [[1d10+3]] or a non-inline roll, like /roll 1d10+3.
Then the line " Note: All helper functions will only check the first inline roll found in a property. " is misleading if the helper functions don't all check the same thing.&nbsp;