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

Character Sheets with API functionality?

1526928619
Quinn
Pro
Sheet Author
So, I've been working on a character sheet for a year or two, and using it in my own games as a custom sheet. It's for a system that I co-wrote, and I've been using a companion API scripts file to add a bunch of convenience functionality - for example, typing "!init" as the GM to automatically roll initiative for all characters on the current page and add them to the turn tracker, or having technique usage automatically reduce stamina bars on tokens, or auto-tracking cooldown times on abilities and informing the player when they're usable again. I'm looking at submitting it for public use in the near future, and that's where things get tricky. Right now, the sheet works due to a combination of the HTML/CSS files in the General Settings tab and the JavaScript file in the API tab. I've been looking through the Github page, and I don't see any other games that use this kind of logic - specifically, special commands keyed off of "on('chat:message')" worker events. I could make a simplified version that strips out all that fancy logic, but the sheet would lose a LOT of what makes it cool if I did.   Is this possible to do entirely through the character sheet HTML file? I tried just putting the JS in via a <script type="text/worker">, but it doesn't seem to pick up on the chat events. If that can't be done, is there any sort of standard practice for bundling together a character sheet and a scripts file for use via the API? If not, how else could I approach getting this sheet usable? Thanks in advance.
Unfortunately the only way this can be done is through a separate character sheet and companion script. There are a number of existing character sheets using this format: the Shaped sheet for 5e and Star Wars character sheet for example.
1526934706
Quinn
Pro
Sheet Author
Aha! I hadn't realized that there's a separate repo for scripts. That'll do nicely, I think.
1526940826
Finderski
Plus
Sheet Author
Compendium Curator
Just realize, if you don't work on the sheet to strip out the API stuff so it can stand on its own, then only Pro subscribers will be able to use your sheet. The 5e Shaped sheet is enhanced by the API, but NOT dependent upon it.  So, if the sheet just won't function at all without the API, you'll want to mention that in your sheet JSON file, etc.