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] D&D 5e Shaped NPC & Spell Importer

1447861077
Kryx
Pro
Sheet Author
API Scripter
I know of no monster json format out there, otherwise I'd write an importer for that. (that's what spells does) For monsters it expects you to copy the words out of a PDF.
This will work for me for like one monster then it locks up and won't make anymore.
1448129996

Edited 1448133727
Kryx said: I know of no monster json format out there, otherwise I'd write an importer for that. (that's what spells does) I have all monsters from Monster Manual in MySQL DB and I use it to render stat block for your script, because if I copied stats from pdf it was with lot of errors and I must do correction manually. I can generate JSON file from that if you want. Just send me skeleton how you wanna the file look like. 
1448156356
Nick S.
Pro
Marketplace Creator
Translator
That sounds superb, if it can be done it'll save everyone even more time than with just the script, which already helps a ton.
1448278706

Edited 1448278754
Hello everyone! I am looking for volunteers for look through the JSON file and check for spelling mistakes, missing information, etc. If you wanna help, send me a private message and I give you a link to the file.
1448280211
Kryx
Pro
Sheet Author
API Scripter
I'd suggest this no longer be discussed on this thread lest it raise the concern of the mods.
1449099798

Edited 1449101410
Kryx
Pro
Sheet Author
API Scripter
Dec 2nd 2015 Removed the scripting to convert from the D&D 5e Legacy sheet Added a new monster import that imports from JSON. Command is "!shaped-monster --MONSTER_NAME". You can also add on the "--clean" command at the end. For example: "!shaped-monster --MONSTER_NAME --clean". I verified that the following work: All normal things like name, size, type, alignment, AC, HP, speed, abilities, saving throws, skills, senses, languages, challenge, damage resistances, damage vulnerabilities, damage immunities, condition immunities, token macros (init, save, check), traits Actions Multiattack Legendary Action Lair Actions (if they're setup, none of mine have them yet) All token items like name, vision, bars, etc Spells import automatically if they're included in the JSON "!shaped-token-macro" is now "!shaped-token". It is most commonly used to to "!shaped-token --boostrap" though that can now be done without the "--bootstrap", so "!shaped-token" works as well. Old importer still works from the few that I tested I could use some help in the parsing. Many monsters have extra traits/actions due to line breaks. If someone could help me fix that it'd help a lot. We also need to parse lair actions. PM me if you want to help.
Thank you Kryx!  Your scripts save me scores of hours and make my games sooper smooth!  
1449107043
Nick S.
Pro
Marketplace Creator
Translator
Thank you Kryx! It seems to be working great as far as I can see (only tested a few monsters so far). A problem I did see though, is that whenever you drop a new monster already created into the maps, the AC is missing from the token. It does appear the first time you create it, and it is present in the sheet. Thanks again!
1449114549

Edited 1449120016
where is the JSON for the monsters?.... Also, updated the API and now the spell importer is not working using !shaped-spell --spell1, spell2,...do I need to set something up again?  I had help with initial setup.  What am I missing? getting the following output. "msg.content: !shaped-spell --magic missile" "Exception: TypeError: Cannot call method 'filter' of undefined"
1449134724
Kryx
Pro
Sheet Author
API Scripter
Nick, the AC is set to bar1 (green bar) for me. Maybe verify that you haven't changed  the settings at the top of the script? And ensure you edit the character and set the default token (roll20 doesn't allow us to do so via API). @Den: Monsters are handled the same as spells. You'll need to include another script on your api (I call mine 5e-monsters) which is basically var dndFifth.monsters = { monsters: [ INSERT HERE ] }; See my github for some examples (see PM). Both Fireball and magic missile are working for me. !shaped-spell --magic missile !shaped-spell --fireball You likely didn't update the spells file. It was previously called "fifthSpells.spellsData". Now it is "fifthSpells.spells". It would be at the top of the file.
1449134893
Kryx
Pro
Sheet Author
API Scripter
Also, huge caution: The character sheet will likely undergo a larger revamp soon. So importing en mass now may not be the best idea.
Kryx said: Also, huge caution: The character sheet will likely undergo a larger revamp soon. So importing en mass now may not be the best idea. What about the currently existing things created and managed using your character sheet? What will happen to them when you update?
1449135762
Kryx
Pro
Sheet Author
API Scripter
The plan is to use sheetworkers to do any conversion. If that doesn't work I'll offer a v2 of the sheet and a script to convert all.
1449169664

Edited 1449169681
Kryx
Pro
Sheet Author
API Scripter
Dec 3rd 2015 Spells now pull from traits directly (no need to have a separate parameter) Tons of parsing fixes Added all lair actions Added SCAG spells
Aloha Kryx, 1.)  Given that you don't want any more subscription time -- you might throw up a donate link on your github readme so you have some place for people to throw coin at you. 2.)  I noticed you had a homebrew spells file.  I use some spells from different sources and have the same thing, but I've just been appending it when I update.  Since yours is a separate file I'm guessing you have a better method and I'm curious if you would describe it.  I was thinking you could code an append to the array in the variable, but I don't know how to do that if one snippet loads before the other.
1449447846
Kryx
Pro
Sheet Author
API Scripter
Hey Jason, 1. Will do. 2. The spells on that file will replace any spell of the same name on the RAW file. It will also add any new ones. If you've forked my version you can run 'gulp compileHouseruledSpells' and that will generator a js file called "5e-spells-houserules.js". Basically you need to fork my code, npm install and then run that command. Otherwise if you're not a programmer and don't want to google to figure it out then you can just take spellData.json, add some entries, and then copy the data: fifthSpells = { spells = [PUT SPELLS HERE - be mindful to keep 1 set of square brackets] };
Got it, thanks.  I was thinking you were doing it in roll20, but streaming your setup and then uploading it to roll20 makes perfect sense.  Thanks Kryx!
Not sure what Im doing wrong here, I was updating my 5e-spells.js and adding 5e-monsters.js and now I am getting this error from the API output console: For reference, the error message generated was: Unexpected token =
Nov 20th sheet, and Dec 2nd shaped script, BTW.
1449489444
Kryx
Pro
Sheet Author
API Scripter
Was that on updating the scripts? Sounds like you didn't put them in correctly. Make sure to remove everything before copy+pasting.
1449495382

Edited 1449496089
@Kryx I tried updating my spell script, but when I try and import a spell, it was saying: (From Shaped): Exception: TypeError: Cannot call method 'filter' of undefined I deleted the old spell script and copy and pasted the new one in from the RAW
1449495943
Kryx
Pro
Sheet Author
API Scripter
Kryx said: You likely didn't update the spells file. It was previously called "fifthSpells.spellsData". Now it is "fifthSpells.spells". It would be at the top of the file.
Kryx said: Kryx said: You likely didn't update the spells file. It was previously called "fifthSpells.spellsData". Now it is "fifthSpells.spells". It would be at the top of the file. I think I see the issue. It's working now.
Can we get the idiots guide to installing both the new Json files and the Import script?
1449532550
Kryx
Pro
Sheet Author
API Scripter
It's purposefully vague for reasons. If you can't figure it out PM me and I'll address it tomorrow.
Kryx said: Was that on updating the scripts? Sounds like you didn't put them in correctly. Make sure to remove everything before copy+pasting. When I create a new script I get " Unexpected token = " even with only this pasted in the script: fifthSpells = { spells = [] }; I also tried creating a fresh game to test, and got the same result. Thanks for any help on this.
1449566655
Kryx
Pro
Sheet Author
API Scripter
I've updated the OP with examples of how the files should look. John, can you invite me to your campaign make me a GM so I can look at your scripts?
If you could share the result of such, I'm also getting that error with or without content (though I'm attempting some Monster Importing)
1449592942
Kryx
Pro
Sheet Author
API Scripter
You can invite me to your campaign as well.
Will do, though - and this makes no sense to me, just seems they would be matched - I put a closed "};" and it's not doing the token error anymore.   I think it was a copy paste error on my part.  But I'll add you to where I'm testing (and thank you) FYI, the Monster's import created the Characters Sheets, but without attacks or their stats, but I'm going to remove them and see if I do it again if my mistake was the same problem or if I'm just very clever in my ability to muck things up.
fifthSpells = { spells = [PUT SPELLS HERE - be mindful to keep 1 set of square brackets] }; After comparing this example from this page to your example in the OP, it looks like the " = " after spells in the second line is the problem. Also the monsters example on this page returns an error as well: var dndFifth.monsters = { monsters: [ INSERT HERE ] }; To be clear, the examples in the OP work perfect. Thanks Kryx for all of your hard work!
1449633025

Edited 1449633116
Monster importer working for me as well, but missing stats like Modnar. Attacks don't roll to hit. Upon further investigation, all of my character sheets are now missing the modifiers from stats... May be a new sheet bug as I pulled today's sheet and script (Dec 8th).
1449645558

Edited 1449645646
Kryx
Pro
Sheet Author
API Scripter
We found the problem. The newest sheets require code that is on dev. You guys didn't read the warning on that thread. :P I imported several monsters and spells yesterday with no problem using the older sheet.
Thanks Kryx! Definitely missed any warnings.
1449681612
Kryx
Pro
Sheet Author
API Scripter
No worries. It's a bit hard to keep it all in sync.
1449699646

Edited 1449699668
Kryx
Pro
Sheet Author
API Scripter
Modnar you had too many square brackets. I fixed that. I also set you up with what I was talking about below. I tested a few and they seem to work. Keep in mind I have a bunch of examples on my Github. Make sure to take a peek in the scripts folder to save yourself a lot of work.
I seem to be having trouble with monsters that have spells, when I try to import them the API freezes but doesn't acknowledge the input. Sorry if I missed something you've already stated, I tried to see if others were experiencing this first.
1450090527
Kryx
Pro
Sheet Author
API Scripter
What monster? Via "!shaped-import" or "!shaped-monster"? If import please include the block so I can test.
Kryx said: What monster? Via "!shaped-import" or "!shaped-monster"? If import please include the block so I can test. It started with Mage, I eventually found it froze the API so I had to re-save/refresh to start it again, I tested it on archmage and druid and both had the same result. This was done via !shaped-monster.
Mark (Kryx),  Great work man, haven't had a lot of time to roll dice but i'm back and i love the additions... Fantastic. We've talked about this a bit before but wondering with this super script work how far off a Char Gen is for importing stats into your PC Sheet? Using the example of the Monster Sheet. I could see this being an easy adjustment but obviously still requires a bit of work to do an "import" assuming you create it with some sort of online generator you might be better off just typing the data in..  { "name": "Legolas", "size": "Medium", "type": "Wood Elf", "alignment": "chaotic good", "HP": "13 (3d10+9)", "Level":"3","Class":"Fighter","Class":"Fighter","Class":"Fighter" "speed": "35ft.", "abilities": "STR 14 DEX 20 CON 17 INT 13 WIS 12 CHA 14", "skills": "Stealth +5, Perception +3, Athletics +4", "senses": "Darkvision 60ft" "languages": "Elvish", "background": "Outlander" "Race traits": +5 ft movement speed, Elf Weapon Training, Mask of the Wild "Class traits": "Fighting Style: Archery, Second Wind" "Melee Weapons 1": "Longsword",Reach:"5 ft",Damage "1d8","Critical": "1d8","Crit Range":"20" "Ranged Weapon 1": "Longbow",Range:"80/320",Damage"1d8","Critical":"1d8","Crit Range":"20" "Armor":"Studded Leather 12, Light" ] } On the other hand if  you could run a script and have the script pull data (realizing that data would have to be from a separate "data" script, like the monster manual or OotA supplements. PHB Race / Classes, SCAG Race / Class Options, EE Race Options. !shaped-import PC --Legolas It prompts for Stats, Race, Background, Skills, Weapons, Spells, Adds Background, Weapons to inventory. The sheet does all the calculations, the script would just be a matter of putting things in the right boxes. Hope that makes sense. :) -Greg
1450121606
Kryx
Pro
Sheet Author
API Scripter
Cameron R. said: It started with Mage, I eventually found it froze the API so I had to re-save/refresh to start it again, I tested it on archmage and druid and both had the same result. This was done via !shaped-monster. Mage and Druid worked for me. Make sure you're not using the latest sheet (default shaped should work). And ensure you're using the latest scripts as well as monsters and spells format. Lots of moving parts that can go wrong, sorry about that, but I can't make it any better in roll20. Feel free to invite me & make me GM if you can't figure it out within ~10 mins of ensuring you have the right scripts.. @Greg: Hey man, welcome back. PCs can be imported via the monster system. You'll have to format it like a NPC and then put it in the notes and "!shaped-import" or into the monster JSON and use "!shaped-monster --NAME". I have too much on my plate to make something custom for PCs so this is the best I can offer. Sorry!
Kryx said: @Greg: Hey man, welcome back. PCs can be imported via the monster system. You'll have to format it like a NPC and then put it in the notes and "!shaped-import" or into the monster JSON and use "!shaped-monster --NAME". I have too much on my plate to make something custom for PCs so this is the best I can offer. Sorry! Thanks, its good to have time to be back. No worries was just a thought as I was looking over your latest work. If only there was a way to create a JSON file from a easy character sheet. I shall have to play around with that.
Kryx said: Mage and Druid worked for me. Make sure you're not using the latest sheet (default shaped should work). And ensure you're using the latest scripts as well as monsters and spells format. Lots of moving parts that can go wrong, sorry about that, but I can't make it any better in roll20. Feel free to invite me & make me GM if you can't figure it out within ~10 mins of ensuring you have the right scripts. No worries! I'll check the scripts when I get back home today, I believe I just updated them last week but I'll check again. As a side note, thank you for all your work! Let me know if there's any way I can support you for what you've done here.
Ok you probably covered this somewhere, but is there a macro to access a spell from the spell list.  I use %{Character name|repeating_weapons_melee_3_weapon} to use melee weapons and can do ranged and class actions. I just can't find one to make macros for casting from the sheet any ideas.
1450159018
Nick S.
Pro
Marketplace Creator
Translator
@KrakerJack, The easiest way to use a macro from the sheet, that works with anything you may have to roll, is to roll it once and then on the chat press the "up" key once. This will show you the entire code used to roll what you just used, just copy what's on the chat now and paste it on a macro to have easy access to it. Cheers.
1450168960
Kryx
Pro
Sheet Author
API Scripter
@KrackerJack referencing repeating macros is in the next dev update from roll20. That should be within a day or two. Until then you'll have to use the method that Nick suggested.