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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Pathfinder Temporary Stat Rounding

1399394190

Edited 1399648759
Sometimes Pathfinder does things so simply they become stupid. For example, with temporary ability bonuses or damage (see here ), every 2 points (positive or negative) creates a temporary modifier, regardless of the score value. I think most people just ignore this and pretend it adds to the ability score, which follows more sane rules (and creates a tiny, tiny reason to allow odd scores on your sheet). Also I'm pretty sure 3.5 did that. But an interesting fact - I'm not sure there's a way, using roll20 math, to achieve this type of rounding. You can't just use floor or ceil, as that'll have the wrong effect at -odd or +odd, respectively. You can't use round, roll20 uses the "round toward positive infinity" convention, rather than the "round toward 0" convention that one would need in this case. I've tried playing around with the new abs() function, doing things like "x/abs(x)" to get the sign of x and then subtract say 0.1 with that sign, which would do what I need it to do (aside, of course, from being INCREDIBLY ugly - but yeah inline rolls. But that doesn't work if the temp modifier is zero...which is probably the single most-common use-case. Ideas? I know Roll20 is designed to be platform-agnostic, but it'd be really nice to have the ability, however one could do it, to round this "correctly". Edit: I'm an idiot and x/abs(x) only tries to work if you are in API-land or using scalars like I was for testing - won't work for macro rolls. Edit2: I'm really an idiot and added that last edit, when in fact we were looking at attribute-based things here, where x/abs(x) would work. Regardless, solution down below.
This is basically the same thing I have just asked for in my thread except I want it for the 40k RP lines.
1399400143

Edited 1399400157
Lithl
Pro
Sheet Author
API Scripter
Instead of x/abs(x) , why not try ((x+n)/(abs(x)+n))/n , where n is 1 more than the absolute value of the highest-magnitude negative modifier possible?
So I think I have a solution: round(x/2.000001) - the number of zeroes is fairly arbitrary, but determines the range over which the function works correctly. This isn't a perfect rounding function for the whole real line, but works for all integers you'd expect to see in PF.