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

Sheet autocalc in API

So basically, if I want use an autocalc value in the API, I have to recreate the calculation in the API, so if the field is comprised of 4 attributes, then I need to declare variables for them, then add them into a combined variable? Is there any way to get the API to parse the calculation for me so I don't have to do this? Just wanting to know before I spend the time typing out all those variables, especially since my Total AC field is AC+DEX mod+size+misc+temp and AC is comprised of 11 fields it's self! (damn my desire to add values for each slot for armors)... thats a lot of var decs to get 1 value lol.
1403381268
Lithl
Pro
Sheet Author
API Scripter
I don't believe there's a way to do it, sorry. Since you're doing basically the same thing over and over, though, you could streamline the process with something like this: var attrNames = ['ac', 'dex_mod', 'size', 'misc', 'temp']; vat totalAC = 0; var character = ... // left as an exercise for the reader _.each(attrNames, function(item) { var attrVal = getAttrByName(item, character.id); totalAC += attrVal; }); // totalAC is ac+dex_mod+misc+temp
I was thinking of making some global functions and variables that I can just call into the scripts when needed.