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

API: Create NPC tokens with custom stats via CSV?

1669491511

Edited 1669491609
Hey all, I've searched through Google/the forums/the API docs, but I'm still not 100% clear on if this works or not. It sounds like I can create a new token via giving it a name and image, and then update that token with stats, attacks, ability, etc. via the API? If so, I'm guessing I can write a JS parser for CSV to update my tokens to have all of my custom NPC stats, but I wanted to confirm before upgrading to the Pro account. Thanks! Edit: this is for DnD 5E :)
1669492055
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Orlo Barkfoot! People have done this in the past. If you are attempting to parse real-world statblocks with a copy paste, be aware that both the source and the desitination (roll20 sheet) can change their specs without notice. There have been several such projects in the past (the Shaped sheet companion script has this function, though it is likely broken now). They tend to have a short shelf life. If you are parsing from data you control (such as a spreadsheet), you can reduce the volatility.
Awesome, I'll read over the docs to see what I can make happen. Yeah this would be my own spreadsheets, so that should help :) Thanks!
<a href="https://app.roll20.net/forum/post/6248700/script-beta-beyondimporter-import-dndbeyond-character-sheets/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/6248700/script-beta-beyondimporter-import-dndbeyond-character-sheets/?pagenum=1</a> I'm not sure what the status of this Mod script is, but it will require a Roll20 Pro subscription to use.&nbsp; The issue is whenever D&amp;D Beyond updates their JSON data the script could potentially need to be updated as well.
1669493051
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Be aware that the script had a lot of issues near the end (due to changes in specs on Roll20 and DnDBeyond), and the instructions in the top post for getting the json are outdated. This post later in the thread gives the current method.
So the next thing I haven't been able to find (I do have stats editing via charsetattr, but reading over the file on github to do that myself a bit more auto-magically) is adding actions (in the 5E sheet it's the area where you say "bite" -&gt; 1d4 -&gt; description or whatever is relevant). Is there a command that I can throw together to add that easily for a selected token or token id? If not I can probably use the ability section, but was hoping :) Thanks!
Actually I think I have a lead based on another post you did, Keith. Found your repo for Token Action that pulls those actions out, and I'm guessing I can cycle through some of the actions to figure out how to add them onto the object :)&nbsp; <a href="https://github.com/keithcurtis1/token-action-maker/blob/master/Token%20Action%20Maker" rel="nofollow">https://github.com/keithcurtis1/token-action-maker/blob/master/Token%20Action%20Maker</a> I'll probably write a tutorial or something if I get this working so it's easier for others later.
1669535304

Edited 1669535391
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You might want to look at the latest version from One Click install. I should delete that old repo, or at least put a redirect note on it. Edit: I just updated it to match the Roll20 repo.