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

Resetting custom character sheets

Hi ! I have a custom character sheet with sheet worker and calculed fields etc.. What I want is a button that reset the sheet and save it. Is it possible to do that without making a script that get manually (like getAttrs["attr1", "attr2", ...] all the attr and set them to their default values? I have a input reset button that visually reset all the fields but it doesn't save. Thanks for your help :) Brandys.
1572873154

Edited 1572873173
GiGs
Pro
Sheet Author
API Scripter
If you want to rest all the values, you'll need to use setAttrs and name every attribute. Sheet workers dont know anything about the content of the html, and have no way to read it. What you can do is create a javascript object which contains all the default values, and an action button for the resets. const defaults = {      strength: 10,       dexterity: 10,       /* and so on, through all the defaults */ } on("clicked:reset" , function() {     setAttrs(defaults); )} This would be pretty unsafe though, you might want to have the rest button hidden by default, and have another button to show it. So that players can erase their entire character with a single click.
Right, that's what I though.. Ok, thanks !