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

[Script] ImportStats - Take monster stat blocks and import them into Roll20 5e NPC sheets

April 09 (3 years ago)

After using Roll20 for nearly a decade I decided I'd had enough of constantly making monster sheets. The addition of the compendium was a big help but since I'm someone that likes picking up PDFs from the dmsguild and various kickstarters it has become the old play at home thing where you have a dozen books with markers for all the monsters you are using - lots of juggling but now it is just PDFs. That or you spend hours remaking them in roll20.

So, after some digging I found that the there were only two things like this already - both from years ago. One for the now no longer updated Shaped sheet and one for the roll20 5e sheet of 7 years ago... So here is my updated version (please be gentle). I have never written in JavaScript before but do code for a living. I also have never needed to use Regex, really, so again, no experience there. Luckily the Regex work was largely already done seven years ago.

Anyway, I made a github instead of just a google doc to share with friends since I figured more people could use it and there are a lot of great people working on scripts here they would likely be able to give some good feedback (or rather, tell me what I did wrong). It has a much better introduction than this: https://github.com/Zanthox/Roll205eSheetImport

I hope this can save some of you some time!

April 11 (3 years ago)

Edited April 11 (3 years ago)

Doesn't work in my campaign

It creates a character whose name is the text given in the token GM notes, but nothing in the character sheet....

step 1 : Create the script


Step 2: Create the macro (I've changed bar link for my campaign)

Step 3 : Create token GM notes (I just took the begining of your example)

Step 4 : The character is created (see the msg in chat but with all the text as his name)

The result :

I guess this is a format pb in the roll 20 text editor, I've tried to redo break etc....(your initial text was paste from notepad) but nothing works....

April 11 (3 years ago)

Edited April 11 (3 years ago)

I've redone everything and introduced line break every line in Notepad before pasting in roll20  (In the previous example I've made that in the roll 20 editor after pasting from notepad) and it works !

This is how it looks in notepad :

and the result :


sebastien g. said:

Doesn't work in my campaign

It creates a character whose name is the text given in the token GM notes, but nothing in the character sheet....

step 1 : Create the script


Step 2: Create the macro (I've changed bar link for my campaign)

Step 3 : Create token GM notes (I just took the begining of your example)

Step 4 : The character is created (see the msg in chat but with all the text as his name)

The result :

I guess this is a format pb in the roll 20 text editor, I've tried to redo break etc....(your initial text was paste from notepad) but nothing works....




April 11 (3 years ago)

Edited April 11 (3 years ago)

Glad it could help! Line breaks are very important- sometimes just pasting in a notepad program (I use Notepad++) is enough but others you have to make sure to add them yourself. Roll20's text editor has caused me all kinds of pain so I gotta recommend using a different one for everything you can.

I did notice that the upload of the TXT to github did seem to mess with the formatting unless you absolutely make sure to paste it in a text editor.

I also noticed that when there is a specific bonus save (with pb), it doesn't work as intended (ie it always make a savong throw with only the ability bonus). I just erase this specific save and input it by hand.

I didn't check for bonus to skill

Zanthox said:

Glad it could help! Line breaks are very important- sometimes just pasting in a notepad program (I use Notepad++) is enough but others you have to make sure to add them yourself. Roll20's text editor has caused me all kinds of pain so I gotta recommend using a different one for everything you can.

I did notice that the upload of the TXT to github did seem to mess with the formatting unless you absolutely make sure to paste it in a text editor.




I did paste it in notepad beforehand but I had to add a break after each line nonetheless

Zanthox said:

Glad it could help! Line breaks are very important- sometimes just pasting in a notepad program (I use Notepad++) is enough but others you have to make sure to add them yourself. Roll20's text editor has caused me all kinds of pain so I gotta recommend using a different one for everything you can.

I did notice that the upload of the TXT to github did seem to mess with the formatting unless you absolutely make sure to paste it in a text editor.







April 11 (3 years ago)

sebastien g. said:

I also noticed that when there is a specific bonus save (with pb), it doesn't work as intended (ie it always make a savong throw with only the ability bonus). I just erase this specific save and input it by hand.

I didn't check for bonus to skill

Zanthox said:

Glad it could help! Line breaks are very important- sometimes just pasting in a notepad program (I use Notepad++) is enough but others you have to make sure to add them yourself. Roll20's text editor has caused me all kinds of pain so I gotta recommend using a different one for everything you can.

I did notice that the upload of the TXT to github did seem to mess with the formatting unless you absolutely make sure to paste it in a text editor.





Yeah- this is a known issue for both Skills and Saves. I can't figure out how to get it to display correctly, I tried a few tricks and it always sticks on the stat+1d20roll. Not sure how to fix this, sadly except as mentioned in the explanation, you can edit the sheet to change a save/skill. Once you do it notices the stats are there and updates.

April 12 (3 years ago)

Edited April 12 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter


Zanthox said:

Glad it could help! Line breaks are very important- sometimes just pasting in a notepad program (I use Notepad++) is enough but others you have to make sure to add them yourself. Roll20's text editor has caused me all kinds of pain so I gotta recommend using a different one for everything you can.

I did notice that the upload of the TXT to github did seem to mess with the formatting unless you absolutely make sure to paste it in a text editor.

Yup, Roll20's text editor is a rich text editor. It allows formatting, and with formatting comes invisible formatting characters. Always best to use a plain text editor for parsing text.


I made a similar code for 3.5e.

https://app.roll20.net/forum/post/10672575/reviving-srd-importer-by-chris-s/

It is pretty easy to understand so if it provides you with an inspiration, that's good.

In my experience, it is easiest to try to find a text field on the character sheet that uses plain text and then using that to paste in your stat block. But my code does almost the exact same thing except for a different character sheet. This was, likewise, also, my first introduction to JS. So perhaps there were some things I could have done better when writing it. But you live and learn, right?


April 15 (3 years ago)


Astuertz said:

I made a similar code for 3.5e.

https://app.roll20.net/forum/post/10672575/reviving-srd-importer-by-chris-s/

It is pretty easy to understand so if it provides you with an inspiration, that's good.

In my experience, it is easiest to try to find a text field on the character sheet that uses plain text and then using that to paste in your stat block. But my code does almost the exact same thing except for a different character sheet. This was, likewise, also, my first introduction to JS. So perhaps there were some things I could have done better when writing it. But you live and learn, right?



If I ever run 3.5 again, you better believe I'll use it!

Thx for this Zanthox,

Now that I've got my routine on this, It saves me so much time !

PS : I hate pdfs bought on dmguild that are images not text......

April 18 (3 years ago)


sebastien g. said:

Thx for this Zanthox,

Now that I've got my routine on this, It saves me so much time !

PS : I hate pdfs bought on dmguild that are images not text......


So happy to hear it! And same about pdfs... I've run into a couple that you can't copy/paste from. I've started really checking the reviews/comments to see if people mention it before picking one up.