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

1436776543
Kryx
Pro
Sheet Author
API Scripter
Saevar L. "Liquid-Sonic" said: Spell importer would be such a boon, you have no idea... I just wish there was an easier way to create importers. It exists right now. It does everything but parsing the description. You just have to provide the data in the file. Github has some.
So, Mark, my script keeps partially breaking. The importer function works just fine, however, the sheet commands to change the options don't. I tried what you said and made a new campaign and imported my monsters in and it worked just fine. For a few days, now it's broken again. You said you were consulting with Aaron and trying to find out why it keeps happening. Has anything been found out yet? It's a huge pain to transmog all those creatures everytime.
1436800471
Kryx
Pro
Sheet Author
API Scripter
You'll have to be more specific what is breaking. Is the script just not respondind like what happened with Greg? I've only seen that on Greg's campaign and it was fixed by duplicating or creating a new campaign. I have no idea why that was. Greg said he had Aaron look at it. Maybe he has more info? If he doesn't then it's really in roll20's hands. We'd have to be able to provide a consistent reproduction path (maybe your campaign) and create a bug saying "the scripts stop responding with no errors in this campaign".
Mark said: You just have to provide the data in the file. Github has some. Id that file something you want the community to contribute to? As in can we submit more content to that file? or do you want us to start with that and make our own?
1436801743
Kryx
Pro
Sheet Author
API Scripter
Ken M. said: Id that file something you want the community to contribute to? As in can we submit more content to that file? or do you want us to start with that and make our own? The community cannot legally share a file of copywrited spells - no matter if they are in the free version, in EE, or not. I have some examples on github that you can maybe use. I have it in a json file.
OK, so it's every man for himself. That's fine, I just wanted to make sure.
1436802569
Kryx
Pro
Sheet Author
API Scripter
Ken M. said: OK, so it's every man for himself. That's fine, I just wanted to make sure. I don't think you're understanding. There are some examples on my github. Try those.
I just wanna make sure I'm using the correct commands for changing the options: !shaped-settings pcs output_option show !shaped-settings pcs output_option hide !shaped-settings npcs output_option show !shaped-settings npcs output_option hide !shaped-settings all death_save_output_option show !shaped-settings all death_save_output_option hide !shaped-settings npcs initiative_output_option show !shaped-settings npcs initiative_output_option hide !shaped-settings pcs initiative_to_tracker yes !shaped-settings pcs initiative_to_tracker no !shaped-settings all initiative_tie_breaker yes !shaped-settings all initiative_tie_breaker no !shaped-settings npcs show_character_name yes !shaped-settings npcs show_character_name no !shaped-settings all attacks_vs_target_ac yes !shaped-settings all attacks_vs_target_ac no
1436805555

Edited 1439457180
Kryx
Pro
Sheet Author
API Scripter
Those look the same as the ones I posted before, ya !shaped-settings --pcs --output_option --show !shaped-settings --pcs --output_option --hide !shaped-settings --all --death_save_output_option --show !shaped-settings --all --death_save_output_option --hide !shaped-settings --npcs --initiative_output_option --show !shaped-settings --npcs --initiative_output_option --hide !shaped-settings --pcs --initiative_to_tracker --yes !shaped-settings --pcs --initiative_to_tracker --no !shaped-settings --all --initiative_tie_breaker --yes !shaped-settings --all --initiative_tie_breaker --no !shaped-settings --npcs --show_character_name --yes !shaped-settings --npcs --show_character_name --no !shaped-settings --all --attacks_vs_target_ac --yes !shaped-settings --all --attacks_vs_target_ac --no What is exactly happening?
Mark said: Ken M. said: OK, so it's every man for himself. That's fine, I just wanted to make sure. I don't think you're understanding. There are some examples on my github. Try those. No, I understand, my original questions was whether or not we were all going to work together to create a singular data source for the spells, or if we all needed to individually take your examples and create our own. I now know that it is the latter.
1436815109

Edited 1436815168
DXWarlock
Sheet Author
API Scripter
Id say a common source would be better IMO. If I have to make the json for each one, I might as well just type it right on the sheet to start with. otherwise Im typing it all out just to have an extra step to import it anyway.
Mark said: Those look the same as the ones I posted before, ya !shaped-settings pcs output_option show !shaped-settings pcs output_option hide !shaped-settings all death_save_output_option show !shaped-settings all death_save_output_option hide !shaped-settings npcs initiative_output_option show !shaped-settings npcs initiative_output_option hide !shaped-settings pcs initiative_to_tracker yes !shaped-settings pcs initiative_to_tracker no !shaped-settings all initiative_tie_breaker yes !shaped-settings all initiative_tie_breaker no !shaped-settings npcs show_character_name yes !shaped-settings npcs show_character_name no !shaped-settings all attacks_vs_target_ac yes !shaped-settings all attacks_vs_target_ac no What is exactly happening? lol, nothing at all when I type in one of the commands. I tried making a new campaign and importing monsters in, and the commands worked. Then a few days later, they stopped working again. There is no error output or anything, just nothing at all. I invited Aaron to the campaigns and he's going to take a look at them.
1436815840
Kryx
Pro
Sheet Author
API Scripter
If you do happen to find a good list of spells you can just replace the square brackets with the square brackets of it var spellsData = [];
1436816248
Kryx
Pro
Sheet Author
API Scripter
DM Korgul said: lol, nothing at all when I type in one of the commands. I tried making a new campaign and importing monsters in, and the commands worked. Then a few days later, they stopped working again. There is no error output or anything, just nothing at all. I invited Aaron to the campaigns and he's going to take a look at them. Same issue as Greg's issue then. Surprising that it reoccurs after a while. Hopefully Aaron has an idea.
1436816728

Edited 1439457005
Kryx
Pro
Sheet Author
API Scripter
13th July 2015 (1.86) Command options must now be seperated by a space and 2 dashes " --". Example: "!shaped-spell --Zone of Truth" or "!shaped-settings --pcs --output_option --show" Removed repeating action convert script. Spaces in character names and spell names will work now. BREAKING CHANGE The commands for "!shaped-settings" have been changed to have the dashes - sorry for the change, but it's necessary for the other scripts.
I just updated to the new script and it is having trouble with the character id. it crashes every time I try !shaped-spell-import --Priest --Light I get this /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Cannot read property 'id' of undefined at Object.shaped.spellImport (evalmachine. :11318:28) at HandleInput (evalmachine. :9518:16) at eval (
1436818872

Edited 1436818911
Kryx
Pro
Sheet Author
API Scripter
Ken M. said: I just updated to the new script and it is having trouble with the character id. it crashes every time I try !shaped-spell-import --Priest --Light I get this /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Cannot read property 'id' of undefined at Object.shaped.spellImport (evalmachine.:11318:28) at HandleInput (evalmachine.:9518:16) at eval ( Added error messages for providing a spell name that is not on the list or a character name that does not exist. In your case for some reason "Priest" did not exist as a character object.
I had just created the character Priest with !build-monster
1436819267
Kryx
Pro
Sheet Author
API Scripter
Make sure there are no spaces in the actual character journal. For some reason a character by that name does not exist on your campaign.
The !build-monster added a space, or did not delete the space that was there or however. Do I need to make sure there is not a space after the name before I do !build-monster?
Sorry to be such a pain, but Cantrips are not working. other spell levels work (i tried fireball and cure wounds) but Light and sacred flame send a succesful message but do not show up on the character sheet. the index even increments the more i try.
So is the spell importer working fully yet? Does it import descriptions or are you still working on that Mark?
1437302107
Kryx
Pro
Sheet Author
API Scripter
Spells work. I didn't notice kens post so far I'll make sure cantrips work. They import everything from the book - name, casting time, range, description, high-level, etc. I have been distracted by my pf to 5e converter so I have not parsed the description to attack, save, health, etc yet.
1437305623
Kryx
Pro
Sheet Author
API Scripter
19th July 2015 (1.87) Fixed cantrip import for spells
Oh I see, very cool. I shall go tinker just been a busy week.
Ah, you have to manually input the data into the script for the spells?
1437309172
Kryx
Pro
Sheet Author
API Scripter
I have some examples on my github, check those out.
Mark said: I have some examples on my github, check those out. So I played around a bit with the Spell Importer, Mark. Its awesome question though, would it be possible to import multiple spells via one API Command? I'm thinking something like this. !shaped-spell-import --Lich --Animate Dead, Counterspell, Dispel Magic, Fireball
Does the script times out a lot or am I doing something wrong? I can't seem to import any longer description monster e.g. Vampire/Demilich/Lich. ~ <a href="http://pastebin.com/j2NXfsAy" rel="nofollow">http://pastebin.com/j2NXfsAy</a>
1437470626
Kryx
Pro
Sheet Author
API Scripter
@Greg: I have indeed thought about multiple spells at a time. I'll look to add that soon. I may also make it based on tokens instead of having to type a name. @Ninhja: I've never had the the script fail to do a longer description. I will test the lich later. I have had the script just stop responding after dragging a random image on the map. I get no errors, but the script stops responding to further commands until I save it again.
1437856624

Edited 1439457038
Kryx
Pro
Sheet Author
API Scripter
25th July 2015 (1.88) Spells are now imported based on the selected token(s) Spells can now be imported via an array Spell names do not need to be capitalized Example: !shaped-spell --Blindness/Deafness, False Life, Gust of Wind, Invisibility, Levitate, Misty Step, Warding Wind, Call Lightning, Fly, Lightning Bolt, Sleet Storm, Wall of Water, Vampiric Touch, Conjure Minor Elementals, Control Winds, Ice Storm, Cone of Cold, Conjure Elemental This will import all the listed spells to any selected token(s) that has an attached character. I tested that this works on 2 selected tokens. I will parse the spells more this week.
Mark said: 25th July 2015 (1.88) Spells are now imported based on the selected token(s) Spells can now be imported via an array Spell names do not need to be capitalized Example: !shaped-spell-import --Blindness/Deafness, False Life, Gust of Wind, Invisibility, Levitate, Misty Step, Warding Wind, Call Lightning, Fly, Lightning Bolt, Sleet Storm, Wall of Water, Vampiric Touch, Conjure Minor Elementals, Control Winds, Ice Storm, Cone of Cold, Conjure Elemental This will import all the listed spells to any selected token(s) that has an attached character. I tested that this works on 2 selected tokens. I will parse the spells more this week. YAY! Thanks Mark.
Sorry i may have missed it - nut i am having problems with the rolled HP for a bugbear: HP (5d8 + -20) | average: 2 | rolled: 2 this is from: &nbsp; BUGBEAR Medium humanoid (goblinoid), chaotic evil Armor Class 16 (hide armor, shield) Hit Points 27 (5d8 + 5) Speed 30ft STR 15 (+2) DEX 14 (+2) CON l3 (+1) Skills Stealth +6, Survival +2 INT 8 (- 1) WIS 11 (+0) Senses darkvision 60ft, passive Perception 10 Languages Common, Goblin Challenge 1 (200 XP) CHA 9 (- 1) Brute. A melee weapon deals one extra die of its damage when the bugbear hits with it (included in the attack). Surprise Attack. If the bugbear surprises a creature and hits it with an attack during the first round of combat, the target takes an extra 7 (2d6) damage from the attack. ACTIONS Morningstar. Melee Weapon Attack: +4 to hit, reach 5 ft one target. Hit: ll (2d8 + 2) piercing damage. Everything else seems to have parsed ok
1437903998
Kryx
Pro
Sheet Author
API Scripter
con is l3, not 13. That's a L. I'd also recommend fixing stats when copying. I usually move int, wis, and charisma up in cases like this, but it may work otherwise.
I shall no go and stand in the corning shame - thanks for spotting that - i normally do tidy up if it doesnt parse properly &nbsp;- but as i missed the 'l' the change did not take. Thanks for the help
1437904304
Lucian
Pro
API Scripter
Is anyone else having trouble with the auto-rolling hitpoints? It works fine for characters that I created a while back, but more recent characters aren't working at all. After a bit of debugging it turns out that the is_npc attribute is coming back as a string for my more recently created characters, so the test 'isNPC === 1' is failing. Changing that to a == fixes the problem, but I wouldn't want to do that without understanding why that attribute has changed type.... Has something in the character sheet changed recently that would cause this?
1437904671
Kryx
Pro
Sheet Author
API Scripter
I redid the styling of the npc checkbox, but the input is still the same - it should be either a 0 or a 1. That seems to be the case now that I check it. Here is the relevant code: var isNPC = getAttrByName(represent, 'is_npc', 'current'); if(isNPC === 1) { What is likely happening is getAttrByName is returning a string - and has always returned a string. I will check either int or a string of '1'. I have fixed that now if you pull the latest code. Let me know if it doesn't work.
1437904846
Lucian
Pro
API Scripter
Cool, thanks so much for the super-swift response. Will update and test in a moment. The really odd thing is that some character sheets I have (ones I created a while back) still return an integer from that getAttrByName call!
1437906341
Lucian
Pro
API Scripter
Mark said: I redid the styling of the npc checkbox, but the input is still the same - it should be either a 0 or a 1. That seems to be the case now that I check it. Here is the relevant code: var isNPC = getAttrByName(represent, 'is_npc', 'current'); if(isNPC === 1) { What is likely happening is getAttrByName is returning a string - and has always returned a string. I will check either int or a string of '1'. I have fixed that now if you pull the latest code. Let me know if it doesn't work. Yep, that's working now. Thanks mark!
Mark said: 25th July 2015 (1.88) Spells are now imported based on the selected token(s) Spells can now be imported via an array Spell names do not need to be capitalized Example: !shaped-spell-import --Blindness/Deafness, False Life, Gust of Wind, Invisibility, Levitate, Misty Step, Warding Wind, Call Lightning, Fly, Lightning Bolt, Sleet Storm, Wall of Water, Vampiric Touch, Conjure Minor Elementals, Control Winds, Ice Storm, Cone of Cold, Conjure Elemental This will import all the listed spells to any selected token(s) that has an attached character. I tested that this works on 2 selected tokens. I will parse the spells more this week. Where can I put the spells text so I can do this? I know there was a link posted here to spells on github. Just need to know where I put them.
1437911569

Edited 1437913222
Kryx
Pro
Sheet Author
API Scripter
A spell array replaces the [] in the following: var spellsData = []; You can see an example&nbsp; <a href="https://app.roll20.net/forum/permalink/2174764/" rel="nofollow">https://app.roll20.net/forum/permalink/2174764/</a> I recommend waiting until next week. I'm setting up the other parts of the importing now: emote, attack, save, damage, heal, etc. The structure of spells will change slightly.
Roger, thanks for the quick update! I'll wait on that.
1438274119

Edited 1438274946
Kryx
Pro
Sheet Author
API Scripter
I wouldn't recommend updating until I do any testing, but the script is updated - I'll continue working on it and the parse - it's going pretty well. Probably not done by the weekend, but at least lower level spells (1-5). I'll also add the ability to import all spells from a class at some point - it would make cleric, druid, paladin, and other prepared classes easy to import.
1438797803
Kryx
Pro
Sheet Author
API Scripter
26th July - Aug 4th 2015 (1.90) Huge update of spells see <a href="https://app.roll20.net/forum/permalink/2267695/" rel="nofollow">https://app.roll20.net/forum/permalink/2267695/</a> Still ~100 left to check, but I'm gone this weekend and likely won't be able to verify them. Otherwise it should all be working. Query macros will be added to token macros on import soon.
So good to update now?
1438801547
Kryx
Pro
Sheet Author
API Scripter
Ya, you can update. Still some TODOs as mentioned above and if you care about the query macros I'd suggest wait til I add that to the importer.
Those are the click the button and brings up a menu where you can choose which save to roll or which skill to check?
1438802111

Edited 1438802140
Kryx
Pro
Sheet Author
API Scripter
Aug 4th 2015 More Added token query macros There, that should allow you to import. The query macros reference buttons on the sheet so if I make changes to them in the future all of them will be updated.
So, 2 things :) 1. Is there a command to add the query macros to already existing NPCs? Or do I need to go back and update them one by one? 2. I'm trying to import the Earth Elemental, but no matter what I name it, it always sets the name to "Earundefinedlemental" when I click import.
1439055972
Kryx
Pro
Sheet Author
API Scripter
1. Not yet. I will add it soon. 2. Post the stat block please.