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

rollBetween problem in Roll Template

I'm working on a RuneQuest style roll template, and I'm encountering some weird behavior.  I have this block of rollBetweens but it never works with the variable properties passed in and only works with literal numbers: {{#rollBetween() roll 1 crit}}Critical{{/rollBetween() roll 1 crit}} {{#rollBetween() roll crit special}}Special{{/rollBetween() roll crit special}} {{#rollBetween() roll special success}}Sucess{{/rollBetween() roll special success}} {{#rollBetween() roll success fumble}}Fail{{/rollBetween() roll success fumble}} {{#rollBetween() roll fumble 100}}Abdomen{{/rollBetween() roll fumble 100}} Here's an example of how I'm calling it: &{template:skillroll} {{name=@{Ainaadroj Dosh|character_name}}} {{skillname=Intelligence (INT)}} {{success=@{Ainaadroj Dosh|int_current}}} {{fumble=@{Ainaadroj Dosh|int_fumble}}} {{special=@{Ainaadroj Dosh|int_special}}} {{crit=@{Ainaadroj Dosh|int_crit}}} {{roll=[[1d100]]}} I can tell that the variable properties passed in are correct because they're showing up in the rest of the text and also with "allProps".  Side note, "allProps" appears to capitalize the first letter of each property.  I've tried removing all but one of the rollBetween lines and also changing them to literal values.  It only works with two literal values such as the following which will display "Critical" when the roll is between 1 and 75. {{#rollBetween() roll 1 75}}Critical{{/rollBetween() roll 1 75}} Am I stepping on keywords or something?  This similar roll template block of rollBetween statements works just fine.  And I do realize that my critical/special/success/fail/fumble block above will run into boundary issues and I will fix it in a way similar to what I did here by passing in twice as many variables. {{#rollBetween() roll 1 head}}Head{{/rollBetween() roll 1 head}} {{#rollBetween() roll head1 rightarm}}Right Arm{{/rollBetween() roll head1 rightarm}} {{#rollBetween() roll rightarm1 leftarm}}Left Arm{{/rollBetween() roll rightarm1 leftarm}} {{#rollBetween() roll leftarm1 chest}}Chest{{/rollBetween() roll leftarm1 chest}} {{#rollBetween() roll chest1 abdomen}}Abdomen{{/rollBetween() roll chest1 abdomen}} {{#rollBetween() roll abdomen1 rightleg}}Right Leg{{/rollBetween() roll abdomen1 rightleg}} {{#rollBetween() roll rightleg1 leftleg}}Left Leg{{/rollBetween() roll rightleg1 leftleg}}
I changed all of the variable names and I'm still getting the same behavior, so I don't think I'm stepping on keywords.
1525536539

Edited 1525536625
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
From the wiki: {{#rollBetween() <rollname>}} Checks the total of an inline roll for the value. The rollBetween() function accepts two numbers. If the roll result is equal to or between, the section is shown. For example, {{#rollBetween() strength 7 9}} would check the "strength" property for an inline roll that resulted in a seven, eight, or nine. Roll between only accepts numbers, not roll states let alone text values. There is actually no way to have a roll template react to specific text values within a field. They can react to a field being empty or not, but not whether that field says chest or arm.
Ok, the way you said that made me look again at how I was calling it and how I was calling my hit location one.  In the hit location one I was "resolving" the values like "rightarm" by surrounding them with "[[" and "]]".  Once I did that it started working. &{template:skillroll} {{name=@{Ainaadroj Dosh|character_name}}} {{roll=[[1d100]]}} {{skillname=Power (POW)}} {{current=[[@{Ainaadroj Dosh|pow_current}]]}} {{fumb=[[@{Ainaadroj Dosh|pow_fumble}]]}} {{spec=[[@{Ainaadroj Dosh|pow_special}]]}} {{creet=[[@{Ainaadroj Dosh|pow_crit}]]}} {{debug=1}}
1525559639

Edited 1525560985
GiGs
Pro
Sheet Author
API Scripter
Yes, it took me a lot of hair-pulling to figure out that you had to surround attribute references and similar numbers with [[ ]] to get them to be recognised as numbers. You have another, very subtle issue with your rolltemplate. Rollbetween is an inclusive  operator, which means that some of your attack results will overlap into two categories. It looks like you've taken it into account on your location rolls, but not your hit rolls, probably because it crops up a lot rarer on hit rolls yso you haven't noticed it happening yet. At some point, someone with an 80 skill, say, will roll a 4, and the template will report they scored both a critical and a special result. Or roll an 80, and be told they scored a success and a fail. There's a number of ways to account for this. Here's one that should work: Note the use of nesting to restrict the range, and using rollLess on the failure result.  {{#rollBetween() roll 1 critical}}Critical{{/rollBetween() roll 1 critical}} {{#rollGreater() roll critical}} {{#rollBetween() roll crit special}}Special{{/rollBetween() roll crit special}} {{/rollGreater() roll critical}} {{#rollGreater() roll special}} {{#rollBetween() roll special success}}Sucess{{/rollBetween() roll special success}} {{/rollGreater() roll special}} {{#rollGreater() roll success}} {{#rollless() roll fumble}}Fail{{/rollless() roll fumble}} {{/rollGreater() roll success}} {{#rollBetween() roll fumble 100}}Fumble{{/rollBetween() roll fumble 100}} You could also use a similar approach with hit locations, to avoid the need for chest and chest1, rightarm and rightarm1, etc. PS: also your hit quality reports Fumbles as Abdomens!
Yeah, I definitely knew rollBetween is inclusive.  I'll consider your way of doing it.  It is nicer, but I have an automated script creating the buttons for all my different attributes so having the extra "1" versions in there doesn't kill me.