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] Pathfinder Mob/Character Importer

Just a script to help import Pathfinder mobs and characters into Roll20 from the Pazio Pathfinder website or the Hero Labs app. Usage !CreateMob y/n the y/n determines whether the skills will be displayed as abilities. They still will be parsed but will just be turned off in the ability bar. Steps Create a token Copy the text from the pazio mob site or from hero labs File/Output Hero Stat block, Plain Text, StatBlock, Current Hero Only, Copy Paste the test into the token's GM Notes. Run the macro !CreateMob ?{ShowSkills} Enter y if you want skills to be displayed The script will then parse the notes extracting name, init, perception, melee attacks, ranged attacks, special attacks, spells, spell like abilities and skills, create a character sheet, attach it to the token and set them up as abilities for the token. This script uses commas and semicolons as delimiters so be aware of how you use them. The first line is always the tokens name. If there is a link in the ability skill it will be added at the end of the macro as a gm whisper with the link you can launch. Try to keep the formatting simple. I have not decoded all the format codes so if you send it something that is unknown to the script it may crash or generate garbage. Tutorial Video source
1393814554
Konrad J.
Pro
API Scripter
I just watched the video. Great job. I've wanted to do something like this, but no time. This is awesome!!! Especially being able to use it with herolab I can't wait to give it a try.
Starting a Pathfinder game this week and this'll be terrific!!
1393837463

Edited 1393910466
Oh wow, this is incredible. -Edit-- Thank you so much for creating this script, it's absolutely beautiful. It was the final straw to transition to roll20 from Maptools.
This is awesome... I was planning on writing a parser/monster builder for D&D 4e and this will be of tremendous help as I write that script.
You rock! I must play with this. :-)
I don't play Pathfinder, so I probably won't be using this. But that doesn't mean I can't admire the hard work and overall awesomness of this. You deserve a lot of credit for making this happen. I am going to try and find a way to use it for my game (Castles & Crusades), so hopefully I can glean some knowledge from it. But Kudos to you. Very well done.
I am thinking of mentor sponsorship so I can use this. How do I get the code into the game?
1393909520

Edited 1393909573
The code to get into the game is pretty easy, When you become a mentor in the Campaign page there will now be an API link that you click on which brings you to your campaign API's. Just name the script and paste the code and hit save is all you need to do. Link to simple video to show you how to add a script <a href="http://youtu.be/4Tkd-6ab2Kg" rel="nofollow">http://youtu.be/4Tkd-6ab2Kg</a>
Just updated the Gist code, fixed an endless loop condition that could happen, parsed skills with no spaces between the name and bonus better ie Fly+5 will be parsed the same as Fly +5, and also better mark up code handling so you can import from the <a href="http://www.d20pfsrd.com/bestiary" rel="nofollow">http://www.d20pfsrd.com/bestiary</a> in addition to the Pazio PRD site and Heroe's Lab. BTW if you are having problems you can always paste the text into notepad which will remove all formatting and then copy it back out of notepad. This helps with parsing the data but loses the links :(
This has made me and my group very happy. Thank you for your hard work, Peter W!
This leaves me longing for a rep system. Thank you so much, man!
can i comment here, just to be able to return in the, not so distant, future? yes?, thank you =)
Wow. Very impressive script. Extremely useful. Thank you for sharing it!
Minor source update. King found a typo where the "Ranged" substring was not getting removed from the Ability string macro.
Hey Peter, your string replacements can be done easier with string.replace(/%20/g, " "); for example. That would replace every instance of %20 with a blank space.
1394421253

Edited 1394428199
I am now a mentor because of this.( meaning I have joined at mentor level because this is an amazing addition} +1
Cool, I find the Round Tracker and Status Effects Tracker scripts useful also. HB thanks for the regex tip, did not realize replace would take a regular expression.
1394687622

Edited 1394687650
pardon me for my reaction, but... THIS IS AWESOME!!!! like... OMG BBQ 1!!! AWESOME!! xD Thanks Peter W. you deserve donuts, donuts and pancakes =) EDIT: because of typo =), and reasons
Is this a member's only script? I am having trouble executing this script...
Yes, you have to be a mentor to use this script. The GM of the campaign has to be a mentor and have the script installed.
1395428719

Edited 1395429718
Not working for me, not sure what I'm doing wrong. Copied the github script, named it !CreateMob y/n as shown at the top under usage, in the campaign. Made the macro with the text:!CreateMob ?{ShowSkills}. Click on macros while token is selected with un-formatted statblock in the gm notes. See !CreateMob y appear in the chat log and nothing happens. I'm a mentor... what am I doing wrong? Seems to be working now.
I can't get it to run. I've followed the tutorial and I get to the point where the script asks me if I want to show skills. I enter y and.... nothing. Nothing shows up in the chat log or anything. I've tried deleting the campaign and starting over but that didn't work either. Please help.
Can you check 2 things, launch your campaign and also launch a browser with the API scripts from that campaign. Go to your campaign and try running the script after that go to the browser with the API script and let me know what the API Output Console is reporting. If you are seeing an error message. Send me the text of the error and also the text that you are trying to import.
ArcaneShield sometimes the script can be tempermental with formating, if you have something that is not importing right load the text into notepad and then copy the text back out from notepad. This will strip all formatting out. Also make sure to restart the script after it fails. If anyone runs into issues with something not importing feel free to send me the text that is not importing and I will check it out.
1395520045

Edited 1395520242
oh and one other thing the parser gets tripped up on the word "and". Sometimes the text uses "and" to split abilities other times it uses them to add multiple effects. You need to preprocess the "and". if it is used to split 2 abilities replace it with a comma. If it is used to add multiple effects replace it with a slash. for instance you will see this Melee bite +3 (1d6+1 plus disease and paralysis) and 2 claws +3 (1d6+1 plus paralysis) you need to make it Melee bite +3 (1d6+1 plus disease/paralysis), 2 claws +3 (1d6+1 plus paralysis)
I'm an idiot, checked the error code and told me what i had done wrong. I hadn't saved the script. Derp. Thanks for the help
So i just tested this with someone in my campaign. when he selects his character he can click the buttons but only initiative and perception seem to work, everything else gives him an error in chat (ie: Unrecognized command: /emas Deggial Perform (oratory)$[[0]]). When i clicked the skill as the GM it worked fine though. Is that just the way it is or is something wrong.
Good catch was only expecting GMs to use the script for mobs and NPCs. Player cannot use /emas so replace /emas @{selected|token_name} with just /em restart the script and then regenerate the character. I will try to upload a new version to gist that has a switch to do this but might be a few days.
New source to handle and/or's better. Also added a parameter to let the user use emas or ems so players can use it also. usage !CreateMob y/n y/n the first y/n determines whether the skills will be displayed as abilities. They still will be parsed but will just be turned off in the acility bar. the second y/n to determine if the emotes/tells are GM or player emotes/tells. If Y is passed in player emotes are used. new source
This script was working great for me, but suddenly stopped. When I went to the API Output Console, it gave me the following error: TypeError: Cannot call method 'get' of undefined at Sandbox. (evalmachine. :518:36) at eval ( I'm just beginning to learn JavaScript in my spare time and I'm a little over my head. Can anyone help me out here?
1395736440
Alex L.
Pro
Sheet Author
Xyld said: This script was working great for me, but suddenly stopped. When I went to the API Output Console, it gave me the following error: TypeError: Cannot call method 'get' of undefined at Sandbox. (evalmachine.:518:36) at eval ( I'm just beginning to learn JavaScript in my spare time and I'm a little over my head. Can anyone help me out here? To help you with your learning a bit i will explain the error, somewhere in your code (on line 518 if you put all the scripts in one page) you have something.get("something"); but the something (most likly something you are finding using findObjs) is undefined. Undefined unlike a roll20 object does not have the function get so you get that error. The way to fix this is to check that something !== undefined (please note the == rather than =).
Xyld can you send me the paste data you are trying to use that is causing the error. Line 518 looks pretty innocuous, I expect it is just some sort of data that the parser does not know about or a bug in my code. PeterW
Unfortunately, I'm not exactly sure what happened when I got this error. It might have been a monster that I tried to import from the Pathfinder Rise of the Runelords Anniversary Edition with additional info in the stat block, but I was pretty sure that I had been careful in reformatting the stat block to match the standard. Like you, I suspect that it didn't like something that I didn't parse and it may have had a bit of "virtual indigestion" with something that got left over in the system. I tested that theory by deleting the script and then re-installing it and it worked perfectly. Perhaps the script needs something to "clear the palate" if things go wrong? Regardless, if this happens again, I will be sure to post more details. And again, thanks for making this script, it is a huge time-saver. - X
You should mention that you need to download and save the script in the api functionality that is only available to mentors. Just saying.
It is up there just buried in the thread somewhere.
1395971709

Edited 1395972501
Finally got a chance to put some monsters in to parse the stat blocks and test things out. The one thing that I learned for certain is that if the statblock has unnecessary breaks (as in the case of a cut and pasted PDF), the results are not as good as you'd get if you take time to clean up the formatting first.
I replaced line 709 for: var abilityHtmlArray = ""; if (strHtlmArray[1] != null) abilityHtmlArray = strHtlmArray[1].split(","); due to an error importing this character: <a href="http://paizo.com/pathfinderRPG/prd/npcCodex/iconic/seelah.html" rel="nofollow">http://paizo.com/pathfinderRPG/prd/npcCodex/iconic/seelah.html</a>
Xyld yep the PDF are going to require a lot of hand tweaking due to the way they are formated and edited. Felisberto thanks for the bug fix, just updated the gist file.
Thank you Peter for your work. I have been using this (though modifying it to do "/w GM" for the rolls as I do "behind the screen" rolls) mostly for mob importing. I find myself frequently pulling things from the PDF as well, which as you know can be problematic, but so far anything directly from the PRD seems to work pretty well. Thanks again, and hopefully you will consider the PDF aspects (but if not, I understand as formatting there seemed pretty inconsistent).
1396293926
Tom F.
Pro
API Scripter
Peter, this script has saved me so much time! Thank you for all your efforts!!!
This is awesome.
Thanks Peter! This is awesome! @Kevin- The PDF stat blocks just need to be touched up a bit and they will be fine. You can tell where the spaces are by just reading the stat block and closing them. The stat blocks off the PRD work great, never had any trouble with them, but the PFSRD must use some weird formatting cause those almost always get messed up.
@Luke - Yes, I have been touching them up and removing spaces, but have still found several problems with importing them. Still working on it though.
Peter, you are the man, thanks for this! My group uses Neceros' character sheet v1.0.8 and posts them to a shared Dropbox folder, so I'm working on a Python script to translate the XML export from that sheet into block format, so I can autopopulate my PCs into R20 with your script. I'll share it once I've got it working well, if anybody else is interested.
1396492009
Tom F.
Pro
API Scripter
I am having small trouble with the script in that the token GM Notes are not porting over to the character Bio or GM Notes with the new script. With an older version of the script (before the addition of the second y/n argument in !CreateMob y/n y/n was introduced) I hope someone else is having this issue, because I can't figure out for the life of me why this is occurring.
1396503022
Alex L.
Pro
Sheet Author
Tom F. said: I am having small trouble with the script in that the token GM Notes are not porting over to the character Bio or GM Notes with the new script. With an older version of the script (before the addition of the second y/n argument in !CreateMob y/n y/n was introduced) I hope someone else is having this issue, because I can't figure out for the life of me why this is occurring. I am 99% sure that it is currently impossible for a API script to change the notes or GM Notes of anything other than a token due to a bug that will be fixed along with the new character sheets.
Alex is correct.
Setting GM Notes sometimes works if you use simple text, but gets wonky if you have any type of control codes in there. Either way it is buggy,
1396552115
Tom F.
Pro
API Scripter
That would probably explain it. I was getting some transfers into GM notes, but I believe those were plain text stat blocks I had exported from HeroLab. This is still the most useful script out there. You've saved me hours of work!
I just want to point out that, using the most recently posted script, importing the character from HeroLab gave some weird outputs to the macros. Things like arbitrary spaces between the values causing them to not be added, and references to "@{selected|bar1}" which didn't really do anything. Not a coder, so I don't know what lines were throwing those errors, but they seemed to be in the attack and damage macros.