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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Graceful degradation for character sheets and API interaction

1407444639

Edited 1407445092
Actoba
Pro
Sheet Author
Apologies for the /braindump here....just been thinking about some things i'd like to do with my 5e sheet when i find the time and thought i'd better get some of it out of my head while i remember it :) There are lots of character sheets being produced and some of these have normal versions and versions that support/use API features like the power cards script for macros or even more complicated ones doing all sorts of stuff. It would be useful, and probably prevent a lot of duplication of effort, if there was some way sheet authors could maintain a single sheet that provided all the API powered goodies providing the correct API scripts were available to it when the campaign is loaded, but gracefully degraded to a non-API powered version were it not to find the scripts it needed for all the bells and whistles. The most useful example of this would be for macro output either using the power card script, or falling back to a default no API version of it's output if the script/API is not available. In my head this would work by sheet authors having some way of defining a set of scripts the sheet has baked in support for that is referenced and checked when the campaign is loaded....and then, for the power card example anyway, the sheet either uses the API enabled roll macros, or the default non API ones...perhaps defined something like this in the sheet and processed as part of the initial check on the load of the campaign : <button type="roll" name="roll_Example_Roll" value="/em attempts a TEST attack\n\n [[1d20 + @{modifiers}]]" pcardapi_value="!power --ddn| --emote|@{selected|token_name} attempts a TEST roll --name|Test Roll --attack|1d20+@{modifier}"> A simple example of an addition to the json file for the sheet containing an example to replace one attribute with another if a certain script is available might be - { "APISUPPORT": { "replace": [ { "scriptname": "Power Cards", "replace": "value", "replacewith": "pcardapi_value", "intag": "button" } ] } } So in this example on a campaign load if there was a script available named "Power Cards" then every button tag would have it's "value" attribute replaced with the content from the "pcardapi_value" attribute....if the script didnt exist, or either of the replace or replace with attributes didnt exist then nothing happens and the sheet works just fine with the default, non-api campaigns. Is this a better option (or at least the start of a possible solution) to prevent the need for multiple versions of the same sheet being produced (API enhanced,simple without api enahncements, API enhanced using different scripts, etc...)?
1407446580
The Aaron
Roll20 Production Team
API Scripter
Nice concept!
Thumbs up for this!