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

Conditional API load based on which Character Sheet is loaded?

I'm wondering if the script.json can be configured in such a way that it loads a set of API dependencies dependent on which Character Sheet is loaded in the campaign. The reason I ask is that my RPGMaster suite of APIs currently supports AD&D2e with the Advanced D&D 2e character sheet by Peter B. However, I have been asked to port the APIs to also support the Advanced D&D1e sheet by Vince.  I have now completed that port, but the RPGMaster Library API version is different depending on which character sheet is loaded - the library holds all the sheet and game version specific data and processing. My ideal outcome would be that when the RPGMaster Suite is selected to be installed from the One-Click, its script.json sees that the 1e sheet or 2e sheet is loaded and loads the appropriate library. An alternative option is that on selecting the RPGMaster Suite to install, there is a radio button selection to ask the game creator which sheet is loaded and so which library to load. The least favourable option (which I know how to achieve) is that there are two different RPGMaster Suite loaders: RPGMaster Suite v2e and RPGMaster Suite 1e. Thoughts on how to achieve the best outcome, and pointing to examples of script.json files that work best, would be very welcome.
1699882832
timmaugh
Pro
API Scripter
This has been something we're asking for for a while...  To be clear, having some sort of configuration choice made by a GM would mean you'd have to load ALL of your code into the game, then drive what command paths are utilized based on the choice. In other words, there is no interaction between an in-game choice and the ability to designate scripts to be loaded in the game. Keith has used the ask-gm-to-make-a-choice-and-click-a-button model, specifically in... Reporter... I believe it is...? That drives template usage for when the script outputs a message, so it can be handled "late" by being stored in the state.  You can differentiate what code runs with a conditional check that reads a state value, or, with some finesse, you can actually register different functions to be your chat handler based on that state value. I think that having all of the code as a part of one install and having the script ask the GM how to configure itself (based on the sheet) is the best option you're going to find, at present.
1700325730
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Supernotes is the script that asks for a user choice, and it asks between 6-8 sheets. This is a config choice that comes up in chat upon installation. Token Action Maker serves two different sheets. Originally I had code in there that would look for particular attributes and judge on that, but it was too finicky. Now the user just uses an option in the command to access the PF2 sheet. timmaugh's first sentence sums it up. It's something we've asked for. But even if it were added to all Roll20 sheets, it's likely something that would need to be manually added by each sheet creator.
I'm solving it by adding two different loaders for the API suite to the One-Click: RPGMaster Suite AD+D2e RPGMaster Suite AD+D1e The game creator / GM can then choose which to install, and the script.json for that loader will include a dependency for the appropriate RPGMaster Library which will hold databases and character sheet mappings for the relevant character sheet.  There are over 3,000 items that could depend on which sheet and game version you are using, so including both in 1 library would be difficult, and I fully intend to add mappings to other character sheets and rules / databases for other game versions, so if the script.json can't have optional dependencies, this is the solution to go for. Thanks for the advice, and I will add my vote to the call for optional dependencies.
1700350502

Edited 1700350868
vÍnce
Pro
Sheet Author
@Richard fyi: I'm planning on releasing an AD&D 1e Revised sheet soon™.  Been in the works for a while and was put in cold storage due to life...  I've gone through "pains" to make it backward compatible with the old 1e sheet, but there are new attributes, sheetworker calcs, etc.  Just curious if RPGMaster will work with it as well?
1700380756

Edited 1700380916
Richard @ Damery
Pro
API Scripter
vÍnce said: @Richard fyi: I'm planning on releasing an AD&D 1e Revised sheet soon™.  Been in the works for a while and was put in cold storage due to life...  I've gone through "pains" to make it backward compatible with the old 1e sheet, but there are new attributes, sheetworker calcs, etc.  Just curious if RPGMaster will work with it as well? Vince, yes I'd seen that you were working on a new sheet. As long as the attribute names and table "shapes" are mostly the same, there should be little impact.  The main issue is table "shapes" - i.e. have you introduced multi-column tables, or split the weapon table into more than one table, e.g. weapon / damage / ammo? Mostly, the sheet is used for display only - the RPGMaster APIs do all the heavy lifting of interpreting the game rules if the GM chooses to use them. The mapping table includes flags as to whether to trigger sheet workers when updating fields, so I have control over that. Do you have a test game for the new sheet that I can examine the new sheet in?
1700385601

Edited 1700412300
vÍnce
Pro
Sheet Author
There really is little table data other than ability row data that auto-fills each row according to ability score. Attack Matrix tables are handled by the sheetworker as well. Pick class & level and it will fill in the to-hit ac table. Weapon data is manually entered. Like the original 1e sheet, the revised sheet allows the user to enter the appropriate to-hit ac row from the DMG as well as armor type adjustments. Given that enemy AC is "typically" an unknown to the players... attack rolls include the table data whispered to the DM who then makes the determination if its a hit or not.  There's an option to use THAC0 as well.  Its really pretty basic.  You can join the beta game here . p.s Sent you a DM with a link to the latest nightly html/css