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

Calculated Stats help

Ok, I've been working with a custom character sheet for a while, trying to automate as much as I can, and I think I need to use the API to achieve this. When I try to have the HTML try to calculate the stat values on their own, it doesn't work when I try to then use the value in a comparison because it only sees the calculation, and not the result. What I'd like to have happen, is for the character's Calculated stats to be updated whenever one of the base values changes. value:round(@{base_str}*@{str_mod}+@{accessory_str}) This is the calculation I'm using to get @{str} (on the character sheet HTML), which will then be used for macros or other scripts. If I can get the calculated values out of the way, so that only the values are on the character sheet, I shouldn't have any issue with rolls or abilities in the future. I know I can use on('change:attribute' but I only have a basic understanding of java, and I don't know how to reference a specific character or that character's attributes. Any help is appreciated.
1473276027
The Aaron
Pro
API Scripter
I posted to your Character Sheets thread, but I think you can still do this without an API script by doing the formula in the sheet workers. If you WERE going to do it in an API script, you'd know which character based on the characterid of the attribute that prompted the change event.
1473278548

Edited 1473278622
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Getting calculated character sheet attributes from the API is tricky. You can try to get the calculated value by rolling the attribute inline with sendChat and processing the result in a callback. A lot of the time though, it gives an undefined result since it doesn't reliably handle default values very well like the macro engine does.