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

Formula needed for character sheet value attribute.

1435930021
vÍnce
Pro
Sheet Author
This is needed for a hidden input value on a character sheet. I need a formula that takes an attribute(integer) and converts it to a whole number, specifically if the integer is a negative number make it equal to "0", but if the attribute is a whole number already, leave it. Something like if x<=0 x=0, but if x>0 x=x Is this possible? Hope I explained this correctly. Appologies if this should have been posted in the Character Sheet forum. Thanks
1435935448

Edited 1435935537
[[ { floor( @{Int} ) , 0 }kh1 } ]] if @{int} is going to be a dice roll, change that 0 to a 0d0
1435935840
vÍnce
Pro
Sheet Author
Sweeeeeet Mark. For some reason I didn't think I could use the same logic we use for macros for chat... Duh. I'll have a go when I'm off work. Thank you.
1435997533
vÍnce
Pro
Sheet Author
The formula works in that I can pull the expected value from the attribute, however when I try and use the attribute as part of another auto calculated attribute it seems to cause an issue. Made a new post here; <a href="https://app.roll20.net/forum/post/2146299/auto-calc-bug-sheet-limitation-or-other/#post-2146299" rel="nofollow">https://app.roll20.net/forum/post/2146299/auto-calc-bug-sheet-limitation-or-other/#post-2146299</a>
Replace [[ ]] with ( ) maybe?
1435998597

Edited 1435998676
vÍnce
Pro
Sheet Author
Tried that. The formula gets passed instead of the result. @{selected|condition-Flat-Footed} Vince (GM): ( {floor(((floor((18 + 0 + 0 + 0)/2)-5) + floor(0/2) - (floor(abs(0)/2)) - (floor(abs(0)/2)) - 0 - 0 - 0)),0 }kh1} )
1435998756

Edited 1435998900
vÍnce
Pro
Sheet Author
Maybe the nested attributes are causing an issue? current value being used [[ {floor(@{DEX-mod}),0 }kh1} ]]
1436000331
Lithl
Pro
Sheet Author
API Scripter
You can't use a group modifier like kh1 in an autocalc field. You can however use the construction A + B + abs(A - B) / 2 to get max(A, B). See here: <a href="https://app.roll20.net/forum/post/882997/#post-917740" rel="nofollow">https://app.roll20.net/forum/post/882997/#post-917740</a>
1436020487
vÍnce
Pro
Sheet Author
Brian said: You can't use a group modifier like kh1 in an autocalc field. You can however use the construction A + B + abs(A - B) / 2 to get max(A, B). See here: <a href="https://app.roll20.net/forum/post/882997/#post-917740" rel="nofollow">https://app.roll20.net/forum/post/882997/#post-917740</a> You hit the mark Brian. I changed this value ="[[ {floor(@{DEX-mod}),0 }kh1} ]]" to value="( ((@{DEX-mod} + 0) + abs(@{DEX-mod} - 0)) / 2 )" problem solved! Thank you very much guys. Much appreciated.