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 .
×
May your rolls be chill this holiday season!
Create a free account

Issues with calculations in a sheet

So, I'm trying to set up a sheet for Fallout Equestria, in roll20 using the Fallout 3.0 sheet as a template, and when going to set calculations I'm noticing it's rather finicky, sometimes allowing multiplication and division and other times not.  The big problem is that for calculating 'base' skill score you need to set a ceiling function for half the luck SPECIAL stat of the character, however it's downright refusing to devide the luck attribute for the calculation when I use a /, so I even tried to do a *0.5  but that didn't work either, not sure why it's being so picky if it'll multiply/divide things but I've spent the better part of 2 hours now fiddling with trying to get ceiling(@{luck}/2) to work and am getting ready to rip out my hair.  I've included the full code for the skill here and could easily get screenshots of what's happening or a full paste of all the coding I've been through all ready, but yeah, it doesn't look like I derped anywhere but yeah.  I even tried to do a <p hidden> and a <td style="display:none;"> calculation of it in the luck stat as attr="halfluck" to pull that (figuring it was just trying to do to many calcs for one output...some how) and those actually hid the calculation output when I tried to refference them in the 'base-unarmed' calc. <tr> <td>Unarmed</td> <td><input type="number" name="attr_unarmed" value="@{base-unarmed} + @{unarmed-tag} + (@{unarmed-tag-ranks}*2) + @{unarmed-ranks} + @{unarmed-perks} + @{unarmed-traits} + @{unarmed-books} + @{unarmed-items}" disabled="true"/></td> <td colspan="1"><input type="checkbox" name="attr_unarmed-tag" value="15"/><span></span></td> <td><input type="number" name="attr_unarmed-tag-ranks" value="0" /></td> <td><input type="number" name="attr_unarmed-ranks" value="0" /></td> <td><input type="number" name="attr_unarmed-perks" value="0" /></td> <td><input type="number" name="attr_unarmed-traits" value="0" /></td> <td><input type="number" name="attr_unarmed-books" value="0" /></td> <td><input type="number" name="attr_unarmed-items" value="0" /></td> <td><input type="number" name="attr_base-unarmed" value="@{endurance} + @{agility} + (ceiling(@{luck}/2))" disabled="true" /></td> </tr>
1496870719
The Aaron
Roll20 Production Team
API Scripter
(Moved to Character Sheets & Compendium forum)
The only thing that sticks out to me is 'ceiling'. Normally I use 'ceil' instead. 
1496897910
Lithl
Pro
Sheet Author
API Scripter
Yeah, the ceiling function is called ceil .
1496899230

Edited 1496900960
I've tried ceil, round, and ceiling, all of them fail to work, on another skill it wouldn't do @{attr}*2 either so I had to list the attribute twice, it's rather....tempermental with doing the calculations.  I spent 2 hours trying to get it to calc that out and it didn't work any time I tried, instead using the standard value for the 'luck' attribute.  Which, with all the 'base stats' being five should result in a value of 13, and instead is giving me a value of 15 (as it's not dividing 5/2, and rounding up).  I've also tried sub bracketing things to try and get it to focus on that calc but that didn't work. Also: if I tried to use the <p hidden> and <td style="display:none;"> code lines....did you honestly think I didn't try to use ceil, and round before doing those? -edit- The biggest problem is, even without the ceiling functionality in there, it REFUSES to divide the luck attribute by 2, that's the main reason I'm asking for help, is it's not doing multiplication/devision reliably when trying to code it in. -edit part 2- Just to prove a point, again, on this matter  After all, they say a picture is worth a thousand words
1496931756

Edited 1496933877
Yep, just tried flat removing the ceiling function from that and it won't divide the luck attribute at all, not sure why it won't do basic math but this seems less like a 'my code' issue, and more like a system issue the more I test and try things. -edit- Also double checked other places in the sheet where it should multiply or divide, and it's not doing it in those spots either, which reconfirms that something is going wrong server side, not script side in that it won't do calculations beyond addition and subtraction reliably (I got it to multiply by 2, once, and never again beyond that to the point that I started coding it as attry + attry for *2)
1496946964

Edited 1496947036
Lithl
Pro
Sheet Author
API Scripter
I'm betting @{luck} is an autocalc field with a value something along the lines of "@{luck_base} + @{luck_permanent} + @{luck_temporary}", yeah? The way autocalc fields work, they essentially copy and paste the value of one field into the attribute references of the autocalc until there are no attribute references left. So, @{luck} becomes "5 + 0 + 0"... but "@{luck} / 2" becomes "5 + 0 + 0 / 2". The division is happening, but because of order of operations, it's only being applied to the last part of the luck calculation, which is 0 in your testing. Assuming I'm right about the value of luck, change it to "(@{luck_base} + @{luck_permanent} + @{luck_temporary})" and see if the division/multiplication is working properly.
Ah, yep, that actually fixed it, which means they need to update the wiki to denote that if your pulling a composite attribute's value, you need to put the () around the value calculation for the pulled attribute.  At the very least that means the wiki for it needs and update to denote that, or a flag in roll20's api it's self needs to denote that a pulled attribute, that's comprised of other attributes should auto calculate as the the intermidiary attribute should be assumed to be in ()
1496982387
Lithl
Pro
Sheet Author
API Scripter
Mizque said: At the very least that means the wiki for it needs and update to denote that You may have missed it, but it is there: Building Character Sheets#Auto-Calculating Values : If your auto-calculated field depends of another auto-calculated field(s), you have to add parenthesis around intermediate formula(s). Otherwise miscalculations could appear.