PDA

View Full Version : PF2E Tools to Fantasy Ground Unity Conversion Tool



Holo74
February 23rd, 2022, 21:49
Hello! I've spent a few weeks learning about python and the PF2e tools website. I've finally managed to make a tool that is able to parse all of the feats into a module.

The first thing that you want to do is head over to the PF2etool website (https://pf2etools.com/index.html).
Then, click on the players table and click on the feats sub tab.
This should bring you to a table of all of the feats.
From here, you should filter the feats that you want and don't want. By default, only a few rulebooks are selected, but you can change that in the filter.
Then, select the top feat and scroll to the bottom of the list and while holding shift press the feat on the bottom.
You'll then right click on the highlighted list and press the pin (or add) option.
After you have your feats pinned, you'll right click on the pinned list (upper right corner) and press the Download JSON Data button.
Place this in an empty folder for now.
Go over to my git page now (https://github.com/Holo74/PF2E-Tools-To-FantasyGround/tree/main) and download the python and OGL.txt. Put both of them into the same folder that the JSON data is in.
Lastly, run the python using python 3.9 (not sure if it is required, but that is what I ran it in) and it should produce 3 files. Only the .mod file should go into your modules folder. Please let me know if you find any bugs or oddities and I'll try to get to them as quickly as possible.

I want to do a few more things with the converter, but my personal life makes this a very slow process.

Holo74
February 23rd, 2022, 22:04
The UsageRequirements.txt is also required to be in the folder with the script as well.

Holo74
February 25th, 2022, 05:58
Current list of things that can be parsed right now:

Feats
Backgrounds
Spells
Beasts (With spell lists)
Hazards
Afflictions
Items

Stargrove
February 27th, 2022, 16:38
I tried this with all the spells and got two "Unhandled Entry type: pf2-sample-box" messages before the module was created. It looks like there are two spells that have "pf2-sample-box" in their entries: Unseen Servant and Summom Deific Herald. Are these placeholders going to do something in the future?

-- When I click on the created module in the Modules window there is nothing there shown in the right hand pane. I believe the OGL entry is supposed to be there at a minimum.
-- As a convenience, there should probably be a clickable item in the right pane to bring up the list of what is in the module (spells, creatures, feats, etc).
-- It would be nice to be able to provide a name for the a module when it is created.

Great work. Looking forward to being able to import all the monsters from all the APs without having to open them all up and do it manually.

Holo74
February 27th, 2022, 16:45
The pf2-sample-box is currently known. It is a bit of a weird entry, but also nice to have as well. I'm going to be handling the type this week so that it matches what is seen in pf2e tools.
I'm not entirely sure how to get the story entries to be in the right hand pane. Is there any place that I can go to that would help me in having it show up there?
That is also a really good idea to have a name for the module. I'll try and get that implemented along with the sample boxes this week.

Thank you very much for the suggestions!

Trenloe
February 27th, 2022, 16:56
I'm not entirely sure how to get the story entries to be in the right hand pane. Is there any place that I can go to that would help me in having it show up there?
There's a <library> section in the module XML that specifies the links and their targets for the right-hand pane in the library window. Have a look at any of the PF1 OGL modules provided by SmiteWorks for examples - PF-SRD-Basic-Rules.mod is a good one as it contains similar information.

Holo74
February 27th, 2022, 17:04
Ah thank you! The library entries were being placed in the wrong parent. I'll push an update with those changes so the licensing is seen immediately.

Stargrove
February 27th, 2022, 17:05
You could create a test module in PF2e with what you need, export it, and then open it up to get a better idea.

To do this start up FGU an empty campaign with nothing loaded, click on the Story button on the right, and create an OGL entry. In the chat window you would type /export, fill in the required text boxes, make sure you select Story in the exported record types, and hit the Export button. The new module will get created in your Modules folder. You can then open it up and see what it looks like in the db.xml file.

Stargrove
February 27th, 2022, 18:04
Saw you made an update and tried creating the spells module again and received the following error in the FGU console:


[2/27/2022 10:50:39 AM] [ERROR] Process Data File (PF2eTools Spells): 'static' is an unexpected token. The expected token is '='. Line 4, position 23.

I had named my module "PF2eTools Spells" at the prompt and figure the error was related to a space in the name of the module. I tried it again with the name "PF2eTools_Spells" and it worked fine. Most modules have spaces in the names, so you might want to look at that.

One other thing...you should include your website icon in the modules that get created.

Holo74
February 27th, 2022, 18:14
Ah yeah I didn't catch that error when I allowed the name changes. I'm still learning how modules are put together and what type of restrictions I'm working within. Thank you very much for testing it and working with me when errors come up! I pushed a small bug fix so that the error shouldn't occur anymore (hopefully).

Stargrove
March 1st, 2022, 23:08
Was poking around the interwebs today and noticed that the python script has been updated to also now parse a file called bestiary-sublist-data.json. Is there a different way to make/pin a list of monsters for export similar to how the lists for spells are created? When I highlight a bunch of monsters and right-click on them I just see "Popout" and "Add".

Holo74
March 1st, 2022, 23:13
Oh yeah! I forgot that the command for the beasts is add instead of pin. I'm not sure why they have a different term, but I'll update both the forum and the github to include the different usage of terms. Hopefully the list will come out very nicely! Also, I haven't been able to do the spells tab just yet as that is requiring a very hefty amount of tweaking of data.

Stargrove
March 2nd, 2022, 01:21
First I tried all the monsters except the CRB and the Bestiaries and this is what I get:


PS H:\FG_TEMP\PF2E-Tools-To-FantasyGround-main> py -3.9 pythonparser.py
Please have the Usage Requirements text within the folder
By using this tool, you agree to the Usage Requirements
By using this tool, you agree to the OGL
Type N disagree and leave the tool: Y
Please enter a new name if you would like to change the current name (pf2e_tools) to something different
Traceback (most recent call last):
File "H:\FG_TEMP\PF2E-Tools-To-FantasyGround-main\pythonparser.py", line 956, in <module>
main()
File "H:\FG_TEMP\PF2E-Tools-To-FantasyGround-main\pythonparser.py", line 950, in main
writeDBFile()
File "H:\FG_TEMP\PF2E-Tools-To-FantasyGround-main\pythonparser.py", line 891, in writeDBFile
writeMonsters(rootXML)
File "H:\FG_TEMP\PF2E-Tools-To-FantasyGround-main\pythonparser.py", line 778, in writeMonsters
monsterAbilityToXML(offensiveProactiveElement, beast.get('abilitiesBot')[i], i + 1)
File "H:\FG_TEMP\PF2E-Tools-To-FantasyGround-main\pythonparser.py", line 235, in monsterAbilityToXML
descriptionString += newLineCharacter + '- Frequency: ' + dictionary.get('frequency')
TypeError: can only concatenate str (not "dict") to str
PS H:\FG_TEMP\PF2E-Tools-To-FantasyGround-main>

No mod file gets written.

I then tried just the first two monsters from that same list (Abberton Ruffians & Abbot Tsujon) and it was able to create the module. Maybe a data issue in the json data?

Holo74
March 2nd, 2022, 01:24
Sadly it is a change in the source formatting. I was checking out the patch notes for today on pf2e tools and it changed the typing for for frequency to a duct type. It'll be fixed within the hour

Stargrove
March 2nd, 2022, 01:45
Yeah, in debugging using Visual Studio Code I was seeing errors thrown in the Frequency JSON tag.

Stargrove
March 2nd, 2022, 02:01
No errors importing now now. Seeing some inconsistencies such as in the Anadi Seeker (actually all the Anadi have this issue) under "Anadi Venom". The only bit that was imported was: (poison);.


Will the proper import of spells into the spell tab be a thing at some point?

Holo74
March 2nd, 2022, 02:12
That is something that I want to try and accomplish. The spells in the actual spell tab are very different and require a lot more messing with data to get it functioning properly. However, it is something I also want to try and get. Sadly, I don't know about the actual actions, but fantasy ground has a way to parse spells so that they have the proper actions appended to them. That way all you have to do is right click on the entry and click reparse.

The venom seems to be really odd. I'll try and look into why it isn't parsing the entire thing as usually it would come with the affliction and name. I'll take a look at it, but it might not be fixed tonight.

Holo74
March 2nd, 2022, 02:39
Everything should be working now. The poison was definitely odd, but I realized my mistake as I manually put in a tag. It should be fixed now. Thank you very much for reporting the errors!

SweegyLeo
January 19th, 2023, 04:09
Everything should be working now. The poison was definitely odd, but I realized my mistake as I manually put in a tag. It should be fixed now. Thank you very much for reporting the errors!

Hello. This is very helpful.
Regarding PF2e for Fantasy Grounds Unity.
I'm wondering about how to convert a JSON file export , (like the pathbuilder export) into a suitable. Fantasy Grounds Unity XML to import.

Do you have advice?
My google searches say it can be done, I'm just not sure, what the best converter is currently? Where to find it?

Holo74
January 19th, 2023, 04:24
So, the data from pathbuilder is very basic. It follows the idea that it'll only provide what is absolutely needed and nothing more. The data is pretty much names and modifications to the base data. I've tried to understand how I can import the character, yet it seems like you'll need to do it from within fantasy grounds itself. The reason I say that is you don't really know how to convert the names to a full character sheet without some points of reference. I personally don't have the skills to create an extension that does the conversion within fantasy grounds. It's kind of a big project that requires a very good understanding of how the data is coming from pathbuilder and how to convert it into fantasy grounds formatting. That would be the first step if you want to make the characters yourself. You would need to make an extension for fantasy grounds that reads the data into the character sheet. Almost like a creature parser, but for players. Hopefully this helps and I'm glad to see that the tool still functions after all this time.

SweegyLeo
January 19th, 2023, 04:54
Right....

If I can export an FGU character to a readable XML... I might be able to see where it's looking for its data,
And then extrapolate.

What about manual entry within FGU.
If I need to add a custom.... Ancestry for example.
Is there any shortcut for the process?

Currently, my first effort (successful if painstaking)
Was open a working Ancestry, and start a blank ancestry, and try my best to make duplicates of each of the entries.
Boosts, traits etc...
Borrowing the language and format from a working entry.

Is that the manual entry process? Or am I missing a shortcut?
It seems like, Boosts worked well, skills might work well,
But I worry abiut some of the other elements that I'm not sure I know how to reproduce.

SweegyLeo
January 19th, 2023, 04:54
So, the data from pathbuilder is very basic. It...
....
Hopefully this helps and I'm glad to see that the tool still functions after all this time.

Thank you for the response!

SweegyLeo
January 19th, 2023, 04:57
So, the data from pathbuilder is very basic. It follows the idea that it'll only provide what is absolutely needed and nothing more. The data is pretty much names and modifications to the base data. I've tried to understand how I can import the character, yet it seems like you'll need to do it from within fantasy grounds itself. The reason I say that is you don't really know how to convert the names to a full character sheet without some points of reference. I personally don't have the skills to create an extension that does the conversion within fantasy grounds. It's kind of a big project that requires a very good understanding of how the data is coming from pathbuilder and how to convert it into fantasy grounds formatting. That would be the first step if you want to make the characters yourself. You would need to make an extension for fantasy grounds that reads the data into the character sheet. Almost like a creature parser, but for players. Hopefully this helps and I'm glad to see that the tool still functions after all this time.

I've been reading online, and it seems that there are several converters for the Beyond JSON export files, to fgu XML import files.
I was hoping that meant that we would have, or could create, a converter for Pathbuilder JSON, to FGU XML.
I do appreciate if the digital challenge is not as easy to implement as one might hope.

Trenloe
January 19th, 2023, 08:18
Currently, my first effort (successful if painstaking)
Was open a working Ancestry, and start a blank ancestry, and try my best to make duplicates of each of the entries.
My recommendation would be to make a copy of an existing ancestry that's close to the one you want and the copy - that's probably a bit quicker.

Trenloe
January 19th, 2023, 08:20
I've been reading online, and it seems that there are several converters for the Beyond JSON export files, to fgu XML import files.
I was hoping that meant that we would have, or could create, a converter for Pathbuilder JSON, to FGU XML.
I do appreciate if the digital challenge is not as easy to implement as one might hope.
As mentioned in my reply to your similar question in another thread - even doing an XML conversion tool won't give you the full end PC. The PF2 ruleset has more automation embedded in the feats, features, abilities etc. of the FG records which trigger when added to the PC - that would be difficult to do in a converter.

SweegyLeo
January 19th, 2023, 08:40
Thank you.

SweegyLeo
January 19th, 2023, 08:42
My recommendation would be to make a copy of an existing ancestry that's close to the one you want and the copy - that's probably a bit quicker.

I will definitely try this. We are currently playing with the starter box, and my new DM license.
Im honestly on a modest budget, so while, I do fully support and appreciate the game, and FG, and PF team.
I do have to think about, when I can expand the library of modukes,
And try to find functional solutions in the meantime.

Anyway, I really appreciate your response. Thank you.

Holo74
January 23rd, 2023, 03:40
I've updated the tool as it wasn't able to run with up to date data structures from the PF2E tools website. Now all the previously working data should work. Keyword is should. I'm not sure if everything works 100 percent, but I managed to add in the ability to link data in my code which is used in like 2 places unfortunately.

Holo74
January 23rd, 2023, 04:19
I've now included traits in the list of acceptable parsing. It was actually very fast and helps a lot with knowing what does what.