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

How to set default sheet attributes?

Currently, I brute-force setting default attributes on new characters with an on(add:character) event in one of my API scripts that applies them via setAttr, but I'm convinced there's a better way.  As a simple example case to illustrate, let's say I want all newly-created characters to have an "attr_strength" attribute set to "1".  How would I do this, either in the HTML code, sheetworker script, or an API script?

April 27 (5 years ago)
Kraynic
Pro
Sheet Author

In the HTML, you can set a default value of each input.  It is as simple as putting value="1" in the input code line.  That gets overridden as soon as something is manually added.  I have a lot of things on my sheet set to 0 to keep macros and roll buttons from throwing errors from blank attributes.

If you aren't running a custom sheet and/or don't want to edit the code, have you thought about making a "Character Sheet Template" character that is set up how you want?  Then you could just copy that every time you need to create a new character.

Oh I'm well past writing code, lol, I'm up to around 30k lines of API and sheetworker script ;)  Amazing that I got this far without understanding how to set default values.  I thought I'd set values for all of my HTML attr fields; maybe I neglected to set hidden inputs for those attributes used by the API alone.  Thanks!