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 JSON dump for D&D 2024 sheets

I am working on a npc importer for D&amp;D 2024. I am new to Roll20 mods, but familiar with javascript. How can I dump the full attributes as json of a D&amp;D2024 npc sheet?&nbsp; I did come across this post describing the new data access pattern being async, but it didn't talk about listing all attributes: <a href="https://blog.roll20.net/posts/roll20-mods-enhance-the-dd-2024-character-sheet/" rel="nofollow">https://blog.roll20.net/posts/roll20-mods-enhance-the-dd-2024-character-sheet/</a>
I don’t think attributes are currently accessible to Mod scripts for Beacon sheets.&nbsp;
1735201207
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Jarren said: I don’t think attributes are currently accessible to Mod scripts for Beacon sheets.&nbsp; If using the Experimental API, then getComputed and setComputed are almost there. getComputed can get all of the stuff that is exposed to token bar linking (and maybe more), but I think setComputed still has a kink or two (and even then, nearly all Beacon 2024 attributes are read-only, so...)
The get and set attributes are interesting. I figured that using them to set attributes would be sufficient for importing NPC characters. Is the findObjs method going to remain untouched so it's only the data access of the attributes not the discovery of them? keithcurtis said: Jarren said: I don’t think attributes are currently accessible to Mod scripts for Beacon sheets.&nbsp; If using the Experimental API, then getComputed and setComputed are almost there. getComputed can get all of the stuff that is exposed to token bar linking (and maybe more), but I think setComputed still has a kink or two (and even then, nearly all Beacon 2024 attributes are read-only, so...)
My current logic to try and dump content is this and it's okay except for not handling the newlines. My concern here is the new getComputed isn't being used so maybe this is the wrong approach? const dumpCharacterData = async () =&gt; { const existingCharacters = findObjs ({ _type : 'character' }); log ( `Found ${ existingCharacters . length } existing characters` ); for ( const char of existingCharacters ) { try { // Base character data log ( ' \n ==================== BASE CHARACTER ====================' ); log (JSON. stringify ( char )); // Get all attributes for this character const attributes = findObjs ({ _type : 'attribute' , _characterid : char . id }); log ( ' \n ==================== SHEET ATTRIBUTES ====================' ); for ( const attr of attributes ) { const name = attr . get ( 'name' ); const rawCurrent = attr . get ( 'current' ); const rawMax = attr . get ( 'max' ); log ( `---- ${ name } ----` ); log ( rawCurrent ); log ( rawMax ); } } catch ( e ) { log ( `Error processing character: ${ e . message } ` ); } } sendChat ( 'tac' , `/w gm Character data dumped to console. Found ${ existingCharacters . length } characters.` ); };
1735226610
The Aaron
Roll20 Production Team
API Scripter
For Beacon sheets, all the calculations and data manipulations take place in the sheet. getComputed() and setComputed() are methods to ask the sheet what the value is and tell the sheet what you want it to be. The sheet is doing the "computing" part of those interactions, not the Mod "API" Server. Additionally, only a select set of values the sheet deals with are provided as computeds. There isn't a satisfactory way via the API to implement an importer for Beacon sheets.&nbsp;
The Aaron said: For Beacon sheets, all the calculations and data manipulations take place in the sheet. getComputed() and setComputed() are methods to ask the sheet what the value is and tell the sheet what you want it to be. The sheet is doing the "computing" part of those interactions, not the Mod "API" Server. Additionally, only a select set of values the sheet deals with are provided as computeds. There isn't a satisfactory way via the API to implement an importer for Beacon sheets.&nbsp; Dang... it seems incredibly difficult to automate setup of external content in Roll20. From my understanding so far: - Roll20 scripts/mods don't support creating pages (<a href="https://app.roll20.net/forum/post/4538850/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/4538850/slug%7D</a>) - Roll20 scripts /mods &nbsp;don't support image uploads (<a href="https://app.roll20.net/forum/post/11347088/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/11347088/slug%7D</a>) - Roll20 scripts /mods &nbsp;don't support creating folders (<a href="https://app.roll20.net/forum/post/6765123/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/6765123/slug%7D</a>) - Roll20 scripts /mods &nbsp;don't let handouts be created in folders (<a href="https://app.roll20.net/forum/post/11051110/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/11051110/slug%7D</a>) - Roll20 scripts/mods don't have a satisfactory way to implement an importer for Beacon sheets (ex: D&amp;D 2024)&nbsp; These are some pretty brutal restrictions for scripts/mods. Is it against terms of service to automate some of this using a browser plugin instead? I know that is generally frowned upon, but Roll20 is the most popular virtual tabletop platform in the world. It seems silly to not let users import their adventure data. The setup for UniversalVTT imports looked incredibly complex as well for another project that seems pretty natural to want more native support. To be clear my goal is the best way to support adventure creators get their content into Roll20 in a reasonable way. Right now it seems incredibly complex.&nbsp; My current thoughts without a browser plugin: - enforce D&amp;D 2014 sheets until D&amp;D 2024 sheets could support import - manually create all pages with specific names - manually upload all image content with specific names - do away with folders. - use a script to set images to pages, import npcs, set images to npcs and import notes. Maybe a browser plugin could remove some of the manual specific setup is my thought.
1735240175
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
AFAIK, there is no restriction about browser plugins (VTTES is not banned, for example), but they would not be supported by Roll20 (ex. scripts have a one-click install system, and the team is dedicated to supporting scripting), it is unlikely that a dev could provide support for a campaign that injects external scripts, and they should not break any laws, or violate terms of service (common sense restrictions against importing copyrighted work, that sort of thing. Caveats: I am not a lawyer, nor an employee or representative of Roll20
1735240177
The Aaron
Roll20 Production Team
API Scripter
You're list&nbsp; is not wrong.&nbsp; I've discussed page creation/delete support and will likely work on that at some point.&nbsp; Ditto journal folders and filing handouts/characters in those folders.&nbsp; I can't think of a way for API scripts to be allowed to upload images safely, but the Experimental branch does have a lot of facility for copying images that are already in the game.&nbsp; Depending on what your workflow is like, I can think of some ways to minimize the work someone would have creating a module from some preloaded structured data (for example, the user could be instructed to create pages and the API script could detect the new page and configure it with the content intended). Automation in your browser wouldn't be supported by the forum, but there are plenty of people that have solved problems by creating a browser to work with the client interface.&nbsp; YMMV.
The Aaron said: You're list&nbsp; is not wrong.&nbsp; I've discussed page creation/delete support and will likely work on that at some point.&nbsp; Ditto journal folders and filing handouts/characters in those folders.&nbsp; I can't think of a way for API scripts to be allowed to upload images safely, but the Experimental branch does have a lot of facility for copying images that are already in the game.&nbsp; Depending on what your workflow is like, I can think of some ways to minimize the work someone would have creating a module from some preloaded structured data (for example, the user could be instructed to create pages and the API script could detect the new page and configure it with the content intended). Automation in your browser wouldn't be supported by the forum, but there are plenty of people that have solved problems by creating a browser to work with the client interface.&nbsp; YMMV. Awesome thank you very much for the feedback and perspective. For full context my project is an AI assisted adventure generator which full adventure data in json (scenes/maps, npcs/monsters, notes, eventually ambience music). I use S3 to persist the images/audio. The game system for these adventures would be fairly fluid and grow over time putting pressure on the npc importing being updated. Ideally, I would like to provide an experience similar to FoundryVTT where our importer can just have the json data pasted and the adventure gets entirely setup in your VTT program of choice. For Roll20: Browser Extension: - Create Pages with specific names - Upload Images and somehow get the Roll20 url (eventually audio too) Then Roll20 Script: - Configure pages with the image urls - Import NPCs with the image urls - Import notes (currently no images, but possibly same image needs) Since the support doesn't seem present for folders easily will likely need to abandon it temporarily unless I can find a clean and easy browser approach. I do have concerns with importing npcs being unavailable for the 2024 D&amp;D monster template, but presumably I could also implement our own custom sheet to support user expectations if necessary. Please let me know if you see any gaps in my thought process additionally, If there is a way for me to toss my voice behind getting folders and/or plages supported for scripts/mods please let me know and I will happily contribute to the best of my abilitly