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 .
×

Division by two on autocalculated field

In my custom character sheet I have a field that contains the total encumbarance of the character (addition of armor and shield encumbarance and general encumbarance) - this is an autocalculated field. Now I want to subtract this value from certain skills (which works fine) and half the encumbarance (rounded up) from the speed of the character. This is where I run into problems. I have the following set as value for my "speed" field in the character sheet: value="@{gk_value}+@{bew_value}+@{gsw_mod}+@{gsw_temp}-ceil(@{combat_beh}/2)" everything works fine, except for the last part. the value of the field "combat_beh" (which is the combined total encumbarance) is not divided by 2 but instead subtracted completely. I tried with extra () around the @{combat_beh } /2 already, and tried to reverse the order of the values etc. Am I missing something?
1493325880
Lithl
Pro
Sheet Author
API Scripter
Did you try ceil((@{combat_beh}) / 2) ? (Or putting the parentheses in the value of combat_beh.) The autocalc system works by essentially copying and pasting the value of each attribute into its @{attr} reference, and repeating until there are no more attribute references. So, for example, something like this: <input type="number" name="attr_a" value="3"> <input type="number" name="attr_b" value="1"> <input type="number" name="attr_c" value="@{a} + @{b}" disabled> <input type="number" name="attr_d" value="ceil(@{c} / 2" disabled> Would essentially result in @{d} being "ceil(3 + 1 / 2)". Apply order of operations, and you get ceil(3 + 0.5), ceil(3.5), 4. If @{c} were instead "(@{a} + @{b})", or if @{d} were "ceil((@{c}) / 2)", the process would be ceil((3 + 1) / 2) -> ceil(4 / 2) -> ceil(2) -> 2.
No, I did not try that. With your explanation I get it, though, including why I had always the full value beeing subtracted... The combined total was a+b , and the character I tested it with had b = 0, while I only ever changed a around. That fixes it, thank you!