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

[BugFix] Repeating Section Default Attributes and Select Element Default Attributes

1469028774

Edited 1469028838
Riley D.
Roll20 Team
I'm doing some work to prep the API to be able to run Sheet Worker scripts, and as part of that I'm fixing a few outstanding bugs. I've just pushed a new API version to the Dev Server which should fix the issues with using getAttrByName() and getSheetDefaultValue() when used with select elements. In addition, now you can get the default values of repeating section elements by doing for example "repeating_skills_attributeone". The default values are the same for all repeating sections so you don't pass in the repeating section ID. Let me know if that broke anything for anyone :-)
1469036839
The Aaron
Pro
API Scripter
Sweet!!
What do you mean by the API being able to run sheet worker scripts? Got an example of how this would benefit us?
1469038628

Edited 1469038828
The Aaron
Pro
API Scripter
It's largely a benefit to character sheet authors that want to have a companion script. &nbsp;Rather than duplicating all the logic for updating dependant attributes on an attribute change (as prompted by something like bumping your strength up a few points), the same logic from the sheet workers of the character sheet could be automatically executed by the "API Player" when it makes a change. I don't know what the actual implementation is (and I'd like to!), but that was the spirit of the discussion a few months ago. Edit: &nbsp;Links of interest: • <a href="https://app.roll20.net/forum/post/3040799/future-p" rel="nofollow">https://app.roll20.net/forum/post/3040799/future-p</a>... •&nbsp; <a href="https://app.roll20.net/forum/post/2872260/sheetwor" rel="nofollow">https://app.roll20.net/forum/post/2872260/sheetwor</a>...
Indeed. It's going to be opt-in somehow, probably based on the character sheet supporting it?&nbsp; But at any rate, the idea is that for example if I'm using the 5E OGL sheet, as a player if I change the "Class" element, some of my attributes get automatically set up for me. Right now if the API were to make that same change (setting "Class" to something), class would change but the sheetworker code wouldn't run. So your only option currently would be to duplicate all of the code on in the API script that's also in the sheetworker, if you wanted to maintain that automatic logic. The new feature would basically allow the API script to "dumbly" just "set class", but then there would be another piece of the API that would come along afterward and go "oh, I notice you just updated Class! Well I have some sheetworker code over here that needs to happen when that happens, so I'll run it!" It basically allows the API to do anything a player can do in terms of a sheet and still have automated sheetworker logic happen.
1469042524
Silvyre
Forum Champion
Sounds great! Thank you!
1469042814
Lucian
Pro
API Scripter
Awesome, very happy to hear that progress is being made on this one!
1469049649
Ada L.
Marketplace Creator
Sheet Author
API Scripter
YES! This should solve a lot of the issues for It's A Trap themes trying to get calculated values from character sheets! It will be so much easier to get characters' ACs, passive perception/spot, etc. now. :)
1469051911
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Oh wait... perhaps I got a little too hopeful. Still getting "(10+@{perception_bonus}+@{passiveperceptionmod})" when I try to get a character's passive perception from the 5E OGL sheet with getAttrByName. :(
Stephen L. said: Oh wait... perhaps I got a little too hopeful. Still getting "(10+@{perception_bonus}+@{passiveperceptionmod})" when I try to get a character's passive perception from the 5E OGL sheet with getAttrByName. :( Yeah this doesn't affect that, it only provides the default value. You can use sendChat() currently (with a callback function) to calculate what the calculated value of the formula should be for the current point-in-time. I might be able to add a simple "calcFormula()" function that can do the same thing but it would just be syntax sugar...
1469067357

Edited 1469067881
Ada L.
Marketplace Creator
Sheet Author
API Scripter
That's what I've been doing. Some of the select-type values for the calculated attributes have caused whole equations to not work in the API, although they work in macros just fine. For those, I've had to manually dissect some of the equations for calculated attributes. Perhaps this update fixes that though? I'll probably ruu it out later.
Stephen L. said: That's what I've been doing. Some of the select-type values for the calculated attributes have caused whole equations to not work in the API, although they work in macros just fine. For those, I've had to manually dissect some of the equations for calculated attributes. Perhaps this update fixes that though? I'll probably ruu it out later. Yes that should be fixed now with this.
1469071670

Edited 1469071726
Lithl
Pro
Sheet Author
API Scripter
Riley D. said: Yeah this doesn't affect that, it only provides the default value. You can use sendChat() currently (with a callback function) to calculate what the calculated value of the formula should be for the current point-in-time. I might be able to add a simple "calcFormula()" function that can do the same thing but it would just be syntax sugar... If the calcFormula function were synchronous instead of async with a callback, that would be more than just syntactic sugar. It probably wouldn't be capable of using QuantumRoll that way, but there are plenty of scripts which use the sendChat callback just so they don't have to parse a math expression with attributes mixed in. /hopeful