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

Stat_mod is not calculating right.

1403234555

Edited 1403235333
So Stat_mod is ((@{Stat_adj}/2)-5) For this calculation, a Stat of 19 should be a 4 modifier, but what is coming out is 14. Is it because I have set the default value for my stats to be 10? So instead of being ((STR/2)-5) I should make its -15? EDIT: No, this can't be right, because as I change the point value of the base stat it either decreases or increases the mod by +-1 when it should be 2 point values for a +-1 on the mod. The value of Stat_adj is the sum of Stat + Stat_mod_misc + Stat_mod_temp. EDIT2: I set the base value for stat to be 0, now the autocalc is just blank like something is missing.
1403241535
Lithl
Pro
Sheet Author
API Scripter
We're going to need to see more code to analyze this. If @{Stat_adj} is 19, then ((@{Stat_adj}/2)-5) should be 4.5. There is either something else in your calculation, or Stat_adj isn't 19 like you think it is.
Yea, I forgot to mention the floor. Anyway here is a gist of the block for STR. All the stats follow this same logic. Also this is the only place where stats are being modified. <a href="https://gist.github.com/mpiersant/00ac50381aa2745a27d1" rel="nofollow">https://gist.github.com/mpiersant/00ac50381aa2745a27d1</a>
1403279865
Sam M.
Pro
Sheet Author
dude, surround @{STR_adj} with parentheses.
1403279951
Lithl
Pro
Sheet Author
API Scripter
Found your problem: @STR_mod = floor((@STR+@STR_mod_misc+@STR_mod_temp/2)-5) = floor((19+0+0/2)-5) = floor((19+0+0)-5) = floor(19-5) = floor(14) = 14 Change STR_adj to "(@{STR}+@{STR_mod_misc}+@{STR_mod_temp})" -- note the added parentheses
Bah, why didn't I think of that, I know how math works. My step daughter is making me swim every day for like 3 hours and im tired all the time now. LOL
1403281966
Lithl
Pro
Sheet Author
API Scripter
You're not the only one to make that mistake, don't worry. It's easy to forget that each attribute isn't a fully-calculated number, it's a string being substituted in at the location you use it. Then it gets calculated. =)
1403285551
Sam M.
Pro
Sheet Author
This is why all my auto calculated values are surrounded by parentheses