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

Auto calc fields saving to attribute?

June 09 (10 years ago)

Edited June 09 (10 years ago)
DXWarlock
Sheet Author
API Scripter
Am i missing something on getting them to save?

using:
input type="number" name="attr_IQ"
input type="number" name="attr_IQ_max" value="@{IQ}-14" disabled="true"
(the max is less than the IQ, we are using it for skill bonus amount based on IQ)

it will not save to attr_IQ_max for the auto calc field. is it possible to get them to save to the attributes?
June 09 (10 years ago)
Lithl
Pro
Sheet Author
API Scripter
Why do you need the auto-calc field to save to the attribute? It will still be accessible with @{IQ|max}
June 09 (10 years ago)

Edited June 09 (10 years ago)
DXWarlock
Sheet Author
API Scripter
Because when pulled with a script with API from character attributes, it returns nothing.
June 09 (10 years ago)
Lithl
Pro
Sheet Author
API Scripter
Um. So use iq.get('current') and subtract 14?
June 09 (10 years ago)

Edited June 09 (10 years ago)
DXWarlock
Sheet Author
API Scripter
Well that would work, but seems weird to have an option to set the field name in the character sheet to set an attribute, that doesn't set an attribute in the players attributes :P Wouldnt it make more sense to treat all attributes the same in API? and not have to remember to do it one way for some, and another way for others?
Seems a recipe to break canned scripts off the forums if someone is calculation an attribute with an auto field vs the person they got the script from typing it.

Also for example, we have skills that are % based per level..the auto calc field figures out % per level attribute..and I wouldn't have to explain to everyone why their attribute for it is blank (or missing totally as an attribute). Getting some players to understand how the character sheet vs attribute auto fill is a pain enough..toss in this and its even more confusing to explain it to them:
"well sometimes it auto fills the correct one, sometimes not but its actually there for macros to use, just its separate between your character sheet tab, and attributes tab, while still the same attribute and usable"

ALSO if someone types something in that 'max' attribute box and I pull it, its that number, vs what the auto calc says it is..thats not good either.

June 09 (10 years ago)
Lithl
Pro
Sheet Author
API Scripter
If you only want the value of the attribute (which is probably true, since it's calculated), you should be able to use getAttrByName(id, 'IQ', 'max')