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

Communication between API and CharacterSheet

Good afternoon. I have two questions 1. Can we in any way detect changes in character sheet from an API? using a on("change... or another function? 2. Is it possible to get values in character sheet from the API? Thanks a lot by advance.
1585746780
GiGs
Pro
Sheet Author
API Scripter
Yes, to both. The API is actually more powerful and capable than sheet workers. Here's a page on Events in the API:&nbsp; <a href="https://wiki.roll20.net/API:Events" rel="nofollow">https://wiki.roll20.net/API:Events</a> And to get values from the character sheet, note that Attributes are simply Objects that belong to the Character Object. So you have numerous ways of accessing them, as detailed here:&nbsp; <a href="https://wiki.roll20.net/API:Objects" rel="nofollow">https://wiki.roll20.net/API:Objects</a> &nbsp;(specifically the Finding/Filtering objects section at the bottom).
1585747242
The Aaron
Roll20 Production Team
API Scripter
Minor additional note: for "autocalc" fields on character sheets (fields whose values are not stored in attributes) you can get the value from the getAttrByName() function.&nbsp; Autocalc fields are out of vogue, but you may still run across them.
Thank you for your answer. Good to know that it is possible. I cannot find the event listener to detect the change of a value in a character sheet though? should it be something like on("change:attribute:&lt;id character&gt;") or something like this?