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 .
×

Monster import script - problem with hitdie

Hi I have a problem with this script called&nbsp; "[Script] Monsters - Automatically import SRD/Monster Manual entries, generate ability macros, and more!" Link:&nbsp; <a href="https://app.roll20.net/forum/post/1761348/script-m" rel="nofollow">https://app.roll20.net/forum/post/1761348/script-m</a>... I have installed the script and I can run it.&nbsp; I have a journal-handout called "Monster Import", where I copied the monster description to. (i.e. as in the example monster.txt from github) When I run the script ("!monster import"), I get the following error message: (From Monster Manager): &nbsp;WARNING: Import failed for troglodyte&nbsp; size/type: medium humanoid (reptilian) hit dice: 2d8+4 (13 hp) initiative: -1 speed: 30 ft. (6 squares) [...] alignment: usually chaotic evil advancement: by character class level adjustment: +2 . Missing mandatory field hitdie. the hitdie line in the Monster Import handout is the following:&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;Hit Dice: 2d8+4 (13 hp) the line in the API-script is the following &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; var regexMap = { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "hitdie" : / ^ Hit Dice: \s * ( [ \d ] + d [ \d ] + [ -+ \d ] * ) /ig , &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; } ; How do I fix this? I found&nbsp; this post &nbsp;where a user encountered the same problem and aparently solved it, but he doesn't say how.&nbsp;
I have been trying to get that script to work for years myself.
Axecleft said: I have been trying to get that script to work for years myself. I presume you did not succeed?&nbsp;
No, I have even tried direct messages to the author. I seem to remember the API was updated a few years ago and given this script's age it might have been broken in the update. I keep saying that I'm going to take a crack at debugging it myself but I and a working, family man and just don't have the time to brush up on js for the foreseeable future. It could be something as simple as a syntax error but I wouldn't be able to spot it.
1589170089

Edited 1589194222
The Aaron
Roll20 Production Team
API Scripter
I'm willing to bet that broke when they changed the editor first handouts. It used to default to plain text, but now it wraps things in some HTML. I feel like I fixed that code to strip out the HTML at some point, I'll have to see if I can find it or patch it again.&nbsp;
1589196446
The Aaron
Roll20 Production Team
API Scripter
Ok, I looked at this briefly.&nbsp; There's a tab between "Hit Dice:" &nbsp;and "2d8+4 (13 hp)" that's getting replaced by some HTML when it is pasted into the editor which is causing the regex to not match, in addition to many other HTML issues.&nbsp; Try this version: <a href="https://gist.github.com/shdwjk/5d6ac5e1e66e13615c19b2234cdbf05f" rel="nofollow">https://gist.github.com/shdwjk/5d6ac5e1e66e13615c19b2234cdbf05f</a>
Awesome Aaron. I am working today but will give the script a try this evening.
1589487897

Edited 1589862030
The Aaron said: Ok, I looked at this briefly.&nbsp; There's a tab between "Hit Dice:" &nbsp;and "2d8+4 (13 hp)" that's getting replaced by some HTML when it is pasted into the editor which is causing the regex to not match, in addition to many other HTML issues.&nbsp; Try this version: <a href="https://gist.github.com/shdwjk/5d6ac5e1e66e13615c19b2234cdbf05f" rel="nofollow">https://gist.github.com/shdwjk/5d6ac5e1e66e13615c19b2234cdbf05f</a> I have installed the edited version and gave it a run through. I still get the error about "hitdie" variable missing. I have Aaron's version of the script installed and Chris S' utility script installed. My Monster Import handout has the following in the notes section: Basilisk Size/Type : Medium Magical Beast (Reptilian) Hit Dice : 6d10+12 (45 hp) Initiative : -1 ( Dex ) Speed : 20 ft. AC : 16 (-1 Dex, +7 natural) Attacks : Bite +8 melee Damage : Bite 1d8+3 Face/Reach : 5 ft. by 5 ft./5 ft. Special Attacks : Petrifying gaze Special Qualities : Saves : Fort +9, Ref +4, Will +3 Abilities : Str &nbsp;15,&nbsp; Dex &nbsp;8,&nbsp; Con &nbsp;15,&nbsp; Int &nbsp;2,&nbsp; Wis &nbsp;12,&nbsp; Cha &nbsp;10 Skills : Hide &nbsp;+1*,&nbsp; Listen &nbsp;+7,&nbsp; Spot &nbsp;+7 Feats : Alertness ,&nbsp; Great Fortitude Climate/Terrain : Any land and underground Organization : Solitary or colony (3-6) Challenge Rating : 5 Treasure : None Alignment : Always neutral Advancement : 7-10 HD (Medium-size); 11-18 HD (Large) When I use the !monster import command I get the following output in chat: (From Monster Manager): &nbsp;Importing Monsters... (From Monster Manager): &nbsp;Processing 1 lines of text... (From Monster Manager): &nbsp;Importing Basilisksize/type:medium magical beast (reptilian)hit dice:6d10+12 (45 hp)initiative:-1 (dex)speed:20 ft.ac:16 (-1 dex, +7 natural)attacks:bite +8 meleedamage:bite 1d8+3face/reach:5 ft. by 5 ft./5 ft.special attacks:petrifying gazespecial qualities:saves:fort +9, ref +4, will +3abilities:str&nbsp;15,&nbsp;dex&nbsp;8,&nbsp;con&nbsp;15,&nbsp;int&nbsp;2,&nbsp;wis&nbsp;12,&nbsp;cha&nbsp;10skills:hide&nbsp;+1*,&nbsp;listen&nbsp;+7,&nbsp;spot&nbsp;+7feats:alertness,&nbsp;great fortitudeclimate/terrain:any land and undergroundorganization:solitary or colony (3-6)challenge rating:5treasure:nonealignment:always neutraladvancement:7-10 hd (medium-size); 11-18 hd (large)... (From Monster Manager): &nbsp;WARNING: Import failed for Basilisksize/type:medium magical beast (reptilian)hit dice:6d10+12 (45 hp)initiative:-1 (dex)speed:20 ft.ac:16 (-1 dex, +7 natural)attacks:bite +8 meleedamage:bite 1d8+3face/reach:5 ft. by 5 ft./5 ft.special attacks:petrifying gazespecial qualities:saves:fort +9, ref +4, will +3abilities:str&nbsp;15,&nbsp;dex&nbsp;8,&nbsp;con&nbsp;15,&nbsp;int&nbsp;2,&nbsp;wis&nbsp;12,&nbsp;cha&nbsp;10skills:hide&nbsp;+1*,&nbsp;listen&nbsp;+7,&nbsp;spot&nbsp;+7feats:alertness,&nbsp;great fortitudeclimate/terrain:any land and undergroundorganization:solitary or colony (3-6)challenge rating:5treasure:nonealignment:always neutraladvancement:7-10 hd (medium-size); 11-18 hd (large). Missing mandatory field hitdie. And the API console log shows: "[MM]: Importing Monsters..." "[MM]: Processing 1 lines of text..." {"name":"Monster Import","notes":1589487452098,"gmnotes":"","inplayerjournals":"all,-M4CnFK7lj4sUTPYxMeR","archived":false,"controlledby":"all,-M4CnFK7lj4sUTPYxMeR","_type":"handout","_id":"-M7FcTPFnd8uUn7fhInx","avatar":""} "[MM]: Importing Basilisksize/type:medium magical beast (reptilian)hit dice:6d10+12 (45 hp)initiative:-1 (dex)speed:20 ft.ac:16 (-1 dex, +7 natural)attacks:bite +8 meleedamage:bite 1d8+3face/reach:5 ft. by 5 ft./5 ft.special attacks:petrifying gazespecial qualities:saves:fort +9, ref +4, will +3abilities:str&amp;nbsp;15,&amp;nbsp;dex&amp;nbsp;8,&amp;nbsp;con&amp;nbsp;15,&amp;nbsp;int&amp;nbsp;2,&amp;nbsp;wis&amp;nbsp;12,&amp;nbsp;cha&amp;nbsp;10skills:hide&amp;nbsp;+1*,&amp;nbsp;listen&amp;nbsp;+7,&amp;nbsp;spot&amp;nbsp;+7feats:alertness,&amp;nbsp;great fortitudeclimate/terrain:any land and undergroundorganization:solitary or colony (3-6)challenge rating:5treasure:nonealignment:always neutraladvancement:7-10 hd (medium-size); 11-18 hd (large)..." "[MM]: WARNING: Import failed for Basilisksize/type:medium magical beast (reptilian)hit dice:6d10+12 (45 hp)initiative:-1 (dex)speed:20 ft.ac:16 (-1 dex, +7 natural)attacks:bite +8 meleedamage:bite 1d8+3face/reach:5 ft. by 5 ft./5 ft.special attacks:petrifying gazespecial qualities:saves:fort +9, ref +4, will +3abilities:str&amp;nbsp;15,&amp;nbsp;dex&amp;nbsp;8,&amp;nbsp;con&amp;nbsp;15,&amp;nbsp;int&amp;nbsp;2,&amp;nbsp;wis&amp;nbsp;12,&amp;nbsp;cha&amp;nbsp;10skills:hide&amp;nbsp;+1*,&amp;nbsp;listen&amp;nbsp;+7,&amp;nbsp;spot&amp;nbsp;+7feats:alertness,&amp;nbsp;great fortitudeclimate/terrain:any land and undergroundorganization:solitary or colony (3-6)challenge rating:5treasure:nonealignment:always neutraladvancement:7-10 hd (medium-size); 11-18 hd (large). Missing mandatory field hitd ie."
Does anyone have any fresh ideas about this script?