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

Judge Dredd (Mongoose Traveller) character sheet - conditional statement for auto-calculated field?

Hi, I'm working on a character sheet for Judge Dredd (Mongoose Traveller). My HTML / CSS skills aren't too hot, but I have enough to get by. However, I'm trying to correct a flaw in the auto-calculated fields for ability score modifiers. The desired results for each score are below: Score Mod 0 -3 1 -2 2 -2 3 -1 4 -1 5 -1 6 0 7 0 8 0 9 +1 10 +1 11 +1 12 +2 13 +2 14 +2 15 +3 I've been able to figure out that the formula floor(score-6)/3 works well enough for scores in the range 1 to 15, however, I get a modifier of -2 for the score of 0. Is it possible to insert a conditional statement similar to the following: if score = 0 then mod = -3; else mod = floor(score-6)/3 ? I hope my query makes sense. Thanks.
1413189038
Finderski
Pro
Sheet Author
Compendium Curator
The short answer is, nope. Can't do that in the character sheet. However, that doesn't mean there isn't a formula that will work; there are some majorly awesome folks on the boards who are wizards with formulas. Unfortunately, I'm not one of them.
1413218591

Edited 1413218737
Lithl
Pro
Sheet Author
API Scripter
Here we go: round(-0.0035014 * @{score} * @{score} + 0.412465 * @{score} - 2.65357) Equation obtained by running "fit {-3,-2,-2,-1,-1,-1,0,0,0,1,1,1,2,2,2,3}" on Wolfram Alpha and comparing the results to the desired scores in Excel, then playing with the values a bit on a trial-and-error basis. You can see the results on a graph here . Caveat: The above equation may not work if the game extends the score attribute beyond the [0,15] range.
Thanks, Brian. You're a true gent. I don't anticipate that the scores will be higher than 15, but you kindly gave me a methodology for finding a solution if they need to. However, after amending the formula and testing the character sheet in my campaign the modifier box did not work at all. Would somebody be so kind as to help me debug the code line below? <input type="number" name="attr_str"/> <input type="number" name="attr_strmod" value="round(-0.0035014*@{attr_str}*@{attr_str} +0.412465*@{attr_str}-2.65357)" disabled="true"/>
1413289995
Lithl
Pro
Sheet Author
API Scripter
When referencing the strength attribute, it's @{str}, not @{attr_str}
Excellent, thanks.