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

Issues with auto-calc

Hi. I'm having a couple of issues with auto calculating values. I've of course checked my formulas manually and they do what I expect, but when I try to use them in the character sheet I get the wrong result. For example this formula: 5+floor(@{Agility}*0.5) is designed to produce the characters action points which is based on it's agility according to this table: Agility AP's 1 5 2-3 6 4-5 7 6-7 8 8-9 9 10+ 10 The formula above when plugged in the character sheet (in a disabled field supposed to show the max AP for the character) shows 1 point more than the expected value. There seems to be some rounding being applied where there shouldn't be any. A similar problem finds itself within the field that is supposed to show the player how many skill points the character has access to at the current level. In the game the character gets no skill points at the first level, so that must be negated. It's a simple formula that goes like this: (@{CharLevel}-1) * @{SkillPointsPerLevel} SkillPointsPerLevel: 5+(2*@{Intelligence}) In the sheet I am looking at right now, Int is 5. This means 5 + 2 * 5 = 15 skill points per level. At level 1 I expect (1 - 1) * 15 =&gt; 0 * 15 = 0 The character sheet however says 10. At level 2 we get the expected 15. At level 3 I expect (3 - 1) * 15 =&gt; 2 * 15 = 30 The sheet now says 20. The complete sheet code can be found here: <a href="https://gist.github.com/Forecaster/f9e3bb4f03f5ec107e01" rel="nofollow">https://gist.github.com/Forecaster/f9e3bb4f03f5ec107e01</a>
1407854604
Lithl
Pro
Sheet Author
API Scripter
attr_Agility is "@{AgilityBase} + @{AgilityMod}", therefore your AP formula is "5 + floor(@{AgilityBase} + @{AgilityMod} * 0.5)". Wrap your attributes that are going into autocalc fields in parentheses to ensure the math works like you expect. In other words, change attr_Agility to "(@{AgilityBase} + @{AgilityMod})". Without looking at the rest of your sheet, I suspect the same issue is causing your other problems.
1407856970

Edited 1407858394
Brian said: attr_Agility is "@{AgilityBase} + @{AgilityMod}", therefore your AP formula is "5 + floor(@{AgilityBase} + @{AgilityMod} * 0.5)". Wrap your attributes that are going into autocalc fields in parentheses to ensure the math works like you expect. In other words, change attr_Agility to "(@{AgilityBase} + @{AgilityMod})". Without looking at the rest of your sheet, I suspect the same issue is causing your other problems. Ah, so when you use an attribute it doesn't include the result, it includes the formula? That would explain the weird results. The solution worked great! Thanks!
1407871622
Lithl
Pro
Sheet Author
API Scripter
Correct. The text of an attribute is substituted wherever it's used.