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 Workers] How to initialize attributes?

1513346355

Edited 1513346470
Missingquery
Pro
Sheet Author
API Scripter
I am attempting to use the API in conjunction with my custom character sheet; however, I've found that I cannot get some attributes on the sheet because they have not been initialized yet, and thus, return as null when using findObjs({}). Is there any way to initialize the attributes via the API without changing their value in any way? They are numerical input values, if that helps.
1513346983

Edited 1513347066
Jakob
Sheet Author
API Scripter
createObj('attribute', { characterid: charid, current: getAttrByName(charid, 'YourDesiredAttributeName'), name: 'YourDesiredAttributeName', }); Another way would be to initialise them on the sheet instead (via setAttrs). Even running setAttrs with the same value that an attribute already has should create an attribute object for it.