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] Import your Pathfinder 2e HeroLab Online Character into Roll20

1608847828

Edited 1609370350
UPDATE: &nbsp;Version 1.1 &nbsp;- Rewrote script to include Jordan's idea of functions for attribute creation. You should now get fewer API crashes as now it should check if an attribute has a value before creating it. Any values that are undefined will be logged in the API sandbox. Added the import of actions/abilities onto the Character tab.&nbsp; Hey all! So here is something I've been working on the last little bit.&nbsp; <a href="https://github.com/aerik1/Import-HLO" rel="nofollow">https://github.com/aerik1/Import-HLO</a> Disclaimer: I'm still a bit of a novice to coding so this may look like the caveman from 2001 beating at the Monolith with his club.&nbsp; Here is what you need to do to make this work. First, go to HeroLab Online and get to the character you want exported. ** IMPORTANT : This is designed for use with PCs only. I have not looked at any of the HLO NPC sheet exports.** &nbsp;Click on the gear in the upper right corner and select Export/Integrate. Then press the Retrieve Export Data button. Wait for the code to appear then copy it to your clipboard.&nbsp; Go to your game and create a brand new character. ** Important :&nbsp;This script will only work on a brand new character without any attributes on it.** The exception to this is the name. Go ahead and edit the character and name it what you want. Then go to the GM Notes section, paste your copied data into it, and save. Once you have that done, drag the token out to the VTT and make sure you have it selected. If you don't, you will get an error from the API.&nbsp; Type into chat the command !importHLO. If everything goes as expected, you will receive a message saying it is done. It may take a second or two depending on the amount of stuff your character has. I would like to say there shouldn't be any import errors, but who am I kidding? So let's go over what this does in the details. One thing to note is that all repeating rows are filled in and expanded by default. You can click the cog icon to collapse them.&nbsp; What this script does (or should do correctly): &nbsp; Level&nbsp; Class&nbsp; Deity XP Background Alignment Hero Points Focus Points Ability Scores and modifiers Skills and Lore Saving Throws Class Feats Actions or Abilities on the character tab What this script does partially: Ancestry and Heritage - Some heritages do not export correctly from HLO. This does not seem to be heritage specific as I have has Twilight Halfling&nbsp;export on one character but not another. If your heritage is not exported, this field is filled with just your ancestry (i.e. Halfling).&nbsp; Hit Points - The export contains your maximum and current HP, but does not break down how much comes from your ancestry and class. Nor does it have any bonuses like the Toughness feat. You will have to add those manually to the sheet.&nbsp; General and Skill Feats - The export contains all of your feats, but has no way to differentiate if you took it as a skill feat or a general feat. I've imported them all into general and if you want to move them, feel free.&nbsp; Ancestry Feats - One of my test character export files did not contact any Heritage feats at all. You may have to add these by drag-and-drop. What this script does not do yet (To do list): Gear Weapon attacks Armor Class Spell Attack and DC rolls What this script cannot do (These&nbsp;aren't in the HLO Export file at all): Perception Class Key Ability Character appearance information (Age, height, weight, etc.) Any money I'm sure there are more I haven't found yet What this script won't do (most likely ever): Spells - There are so many things to import just a single spell into Roll20 that it is more efficient just to use the drag-and-drop to populate your spell list.&nbsp; NPC Sheets - I just make any unique NPCs with PC rules and then change the sheet, adding anything relevant.&nbsp; Again, there may be more.&nbsp; And that is it. I hope that you find this useful.&nbsp; If you encounter any errors, please let me know. There are so many things in a character that I'm sure that some are not going to work for this. If you can, link the export of the character that you are trying to import. I'll do my best. Again, caveman with the Monolith. :) Happy Holidays and stay safe!
This does not work. I execute the !importHLO command and get nothing.
Well, that is an error I hadn't anticipated. I hate to use the "it works on my machine", but I just tried it in a game and it did. :) Is the API throwing an error message?
I think the problem is going to be in the loading of the script.
1608994094
Jordan C.
Pro
API Scripter
It will help to provide a description/screenshot of the API errors or sandbox with it installed - I was able to load it in manually and get it to react to the API commands listed.
I went to the Git Hub, clicked the Import HLO.js link, clicked RAW, copied the stuff, took it to Roll20, did New Script and saved it. Restarted the sandbox and it says Starting webworker script, Loading 964 translation strings to worker. I went to the table and it did nothing. Went back to the API Settings and had an error.
Error: Firebase.set failed: First argument contains undefined in property 'current' Error: Firebase.set failed: First argument contains undefined in property 'current' &nbsp;&nbsp;&nbsp; at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:49) &nbsp;&nbsp;&nbsp; at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:207) &nbsp;&nbsp;&nbsp; at Aa (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:462) &nbsp;&nbsp;&nbsp; at J.set (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:146:98) &nbsp;&nbsp;&nbsp; at createObj (/home/node/d20-api-server/api.js:2738:26) &nbsp;&nbsp;&nbsp; at toDo (apiscript.js:117:11) &nbsp;&nbsp;&nbsp; at apiscript.js:824:13 &nbsp;&nbsp;&nbsp; at /home/node/d20-api-server/api.js:828:7 &nbsp;&nbsp;&nbsp; at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 &nbsp;&nbsp;&nbsp; at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) Restarting sandbox due to script changes... Previous shutdown complete, starting up... Spinning up new sandbox... "Starting webworker script..." "Loading 964 translation strings to worker..."
1608994811
Jordan C.
Pro
API Scripter
Can you provide the JSON used?&nbsp; To me it looks like it that is where the issue is stemming from since it has an undefined value where it likely needs to be null.
<a href="https://raw.githubusercontent.com/aerik1/Import-HLO/main/importHLO.js" rel="nofollow">https://raw.githubusercontent.com/aerik1/Import-HLO/main/importHLO.js</a> That's where I am at when I CTRL-A and copy. I make no changes to anything.
1608995119
Jordan C.
Pro
API Scripter
Right, I meant the JSON for the imported character, not the js file for the script.
I am getting an error every time I try to post it.
It will not let me PM you with it either.
I have two screens up. Every time I type in !importHLO it pushes the sandbox into error. I don't know why I can't post the JSON I copied to the clipboard from HLO here. That's odd.
1609000239

Edited 1609000353
Jordan is probably right. There is something the script is looking for in the character export that it isn't finding. The HLO exports have been ... fussy.&nbsp; For the character data, if you have Dropbox, you can save it in the Public folder and then make a shareable link to it or maybe upload it into Google Drive? Most likely it won't let you post it here because it is a pretty long string.&nbsp;
1609000932
Pat
Pro
API Scripter
You could also try a gist - up on Gitlab - which I think allows .json as a file format.
I put it into a G-Doc and gave him the link to it.
Can I get that link as well? Thanks!
1609113810

Edited 1609113879
Jordan C.
Pro
API Scripter
Sorry for the delay; So it is failing at line 257 where it is trying to write a value for current using "'skills[i].stNet" for the Acrobatics skill. Looking at the character JSON, it doesn't have that property so the code is setting an undefined property for the created object, causing the failure. I don't know much about Pathfinder so I can't provide input for whether or not to just skip setting that property on the sheet if it doesn't exist, but you could certainly check for undefined before setting and sending an error without crashing the API. Something that might work well, but would require a bit of refactoring, is creating a universal function for the object creation like ObjectCreation(name, current, charID) and checking that current is defined else return. Other than "name" and "description" these are the properties I am seeing for the characters acrobatics: " summary " : "Acrobatics measures your ability to perform tasks requiring coordination and grace." , " compset " : "Skill" , " stDC " : 10 , " ProfLevel " : "Untrained"
Thanks Jordan! It is because that stNet is the total of the proficiency score and the ability modifier. I didn't realize that if the character does not have a attribute modifier to an untrained skill, the export will not give it a value.&nbsp; I'll have to create that function in the next couple days. I hadn't thought about automating it like that.&nbsp; I've pushed an update to the GitHub file that should fix it. I know that this is a gradual process as I'm trying to figure out all the possibilities from the character exports.&nbsp;
1609124107

Edited 1609124407
Jordan C.
Pro
API Scripter
For sure! I imagine there will be a lot of nuance along the way. Making a function like that (or for other repetitive processes) will make it easier for you when you need to update as well. I believe this will work for what you have. You can skip passing the char.id since it's declared and doesn't change: const createAttribute = (name, current) =&gt; { if (current == undefined) { log(`HLO Import: no value found for ${name}, skipping create.`); return; } createObj('attribute', { name : name, current: current, characterid: character.id }); }; Then you can do this for all of the attributes (with all the other conditionals you had previously): createAttribute("character_name", herolabData.actors["actor.1"].name);
Bingo! That worked. This particular character was pretty barebones but it worked.
Tried your new script, what it did not do that you said it would do was the following: Skills - I did the Lore's but not the Skills. Saving Throws
Hey Steven,&nbsp; Is the API giving you an error? Can you share your character export for me to look at?
NO API error, you already have it from the Hero Labs forum.
Ah ok. What skills and saves aren't being imported for you? I just tried with the file that you left and everything seems ok for me.&nbsp;
All Skills except Lores and All Saves.
And no API errors, huh? Try running it again on the same character and see what happens.&nbsp;
Still did not work, and no API&nbsp; errors.
Ok, I did a rewrite for a new version. See if that one works.&nbsp;
There were some changes, Class feats and General Feats seemed to separate better, they did not all end up in General this time. Actions got added which they did not last time. Languages got added, was that working before? That said, saves and Skills (Except Lores) are still not working.
Was one API Output: "HLO Import: no value found for repeating_feat-class_-MPrFoii0SHnALwORjIy_feat_class_action, skipping create."
Yep, that just means the feat didn't have an action associated with it. Depending on the character export, you may see more of those. Normal behavior! Though I am at a loss about the skills and saves. I can't seem to reproduce that on my end. At least, it partially works? Yay?&nbsp;
Most of my feats got thrown into "General Feats", "Gnome Obsession" is missing but still applied correctly in skills. Actions are all accounted for but it did lump Low-Light vision in with them. Nice job so far, I've been wanting something like this for awhile. Now I just need something to take monsters off Archives of Nethus so I don't have to manually set that up all the time.
1609538744

Edited 1609538754
Yeah, the export doesn't tell you if you selected it as a skill feat or a general feat so I just threw all of them there. Some heritage feats don't export correctly either.&nbsp; As for low-light vision, it is classed as an ability so that is where it ends up. :) Thanks!
Thanks for sharing this. It looks helpful for people who already have a lot of time into a character in Herolab Online. For me, I think it might be easier just to use the Roll20 sheet with the rules and Nethys' Archives open. Herolab Online underwhelmed me, but I probably got an exaggerated impression from the rotters at Glass Cannon...