Thread: Parser for the 5E pdf rules
-
October 4th, 2013, 12:47 #1
Parser for the 5E pdf rules
Work in progress, but here is a parser that will turn txt files pasted from the 5E rules pdf's into modules usable in 4E fantasy grounds ruleset. This uses one simple java programs, and a windows batch files. Your virus protection might scream warnings. This works great with this extension https://www.fantasygrounds.com/forum...mp-D-Next-(5E)
Currently only Bestiary, Spells, and Class Feature powers.
example of in game info.
Attachment 5202
Instructions for Bestiary, the others are similar (see below)
Step 1
Download the 5EParser.zip file attached below and unzip all the files into a folder that you create. The name of the folder doesn't matter.
Step 2
You must have Java installed. The Java run-time environment. Most people have this installed already, since every other website asks you to install it to work properly. (Java should automatically add itself to your PATH, see below if it doesn't)
https://www.java.com/en/download/index.jsp
Step 3
Open up the Bestiary.pdf you have from the playtest in Adobe Reader.
In the menu go to Edit, and choose “Select All”. Then press CTRL+C to copy all the text.
Open up a new blank .txt file using Notepad.
Press CTRL+V to paste in all the text.
(if your pasted in data has a line break after every single word, that’s fine)
Save the Notepad file as Bestiary.txt and put in your folder from Step 1.
(If it asks you any stuff about Unicode being lost just click OK, we don't need the unicode.)
Step 4
Run the batch file “AAA Create Bestiary Module.bat”
...wait, hopefully nothing goes wrong. You can look at all the command lines to see errors.
Look for the output file DnDNextBestiary.mod which you should copy into your fantasy grounds modules folder. Usually C:\Users\YourName\AppData\Roaming\Fantasy Grounds II\modules
Now when you open up a 4E Campaign you should be able to add this Bestiary within your Library.
FINISHED!
For Spells
Simply copy all the text from the Spells.pdf, save it as Spells.txt and then run “AAA Create Spells Module.bat”
It will create a file named DnDNextSpells.mod
Class Features
For the ClassFeatures there is one special additional change. You can’t save the copied data as a .txt file. Open up the playtest Classes pdf. Copy all the text, and then you have to open WordPad and paste the data into there. Then save that as a ClassFeatures.rtf file. Rich Text Format(rtf) saves the font size, which is the only thing I could use to determine what type of headings there were. Run the "AAA Create ClassFeatures Module.bat"
It will create a file named DnDNextClassFeat.mod
To do the custom Bestiaries
I included an example for White Plume Mountain.
Copy the text from the Mud Sorcerer Bestiary.pdf and save it with a name like BestiaryMudSorcerer.txt
Then, you have to make a few edits within 2 files.
Copy TransformBestiaryWhitePlumeMtn.xslt and name it TransformBestiaryMudSorcerer.xslt
In that xslt file change all instances of DnDNextBestiaryWhitePlumeMtn to DnDNextBestiaryMudSorcerer. You’ll have to do a find and replace.
Make a copy of the batch file “AAA Create Bestiary WhitePlumeMtn Module.bat” and rename it “AAA Create Bestiary MudSorcerer Module.bat”. Within the batch file change all instances of BestiaryWhitePlumeMtn to BestiaryMudSorcerer.
Problems?
I compiled my own java programs for windows and included the class files which you can compile if needed: RegexNextParse.java, Transform.java, and createZip.java. I think it will work on most windows PC’s. If you don't have windows. To compile, you’ll have to install java developers kit to do that.Last edited by JamesManhattan; November 19th, 2013 at 03:41. Reason: added instructions and files
-
October 4th, 2013, 18:01 #2
Woah, I just realized how easy it is to do the entire thing within java. edited my original post.
I'm going to work on Feats, and Equipment, and Magic Items, but those don't seem too urgent to me.Last edited by JamesManhattan; October 4th, 2013 at 21:24.
-
October 12th, 2013, 14:07 #3
- Join Date
- Jun 2006
- Location
- Michigan
- Posts
- 94
What format are you expecting the spells to be in, I try parsing a file with the following content, and it does not get me anything.
Aid
2nd level abjuration
Casting Time: 1 action
Range: 25 feet
Duration: 8 hours
Your prayer calls down a divine blessing of
toughness and resolve. Choose up to three
creatures within range that are not currently
affected by this spell. Each target’s hit point
maximum and current hit points increase by 5
for the duration. This spell has no effect upon
undead or constructs.
Air Walk
4th level transmutation
Casting Time: 1 action
Range: 5 feet
Duration: Concentration, up to 1 hour
Choose a willing creature within range. Until the
spell ends, the target can tread on air as if
walking on solid ground. The target can move
upward or downward at a 45 degree angle at
half its speed. Treat strong winds (twenty miles
per hour or more) as difficult terrain.
If the spell ends while the target is airborne, it
falls if this spell is the only thing keeping it aloft.
At(Higher(Levels: When you cast this spell using
a spell slot of 5th level or higher, you can add
one target for each level above 4th.
-
October 14th, 2013, 21:42 #4
When I copy and paste from the pdf's it looks like the below:
Zone
of
Truth
2nd-*‐level
enchantment
Casting
Time:
1
action
Range:
50
feet
Duration:
10
minutes
Choose
a
point
within
range.
You
create
a
magical
zone
that
guards
against
deception.
Until
the
spell
ends,
any
creature
that
enters
a
15-*‐foot
radius
centered
on
that
point
or
that
starts
its
turn
there
must
make
a
Charisma
saving
throw.
On
a
-
November 4th, 2013, 23:48 #5
- Join Date
- Nov 2010
- Posts
- 328
I get 'java' is not recognized as an internal or external command, operable program, or batch file.
Java is up to date on my machine.
-
November 5th, 2013, 08:02 #6
Regarding the formatting of the text when cut n pasted from the PDFs.
I had this problem when I wrote PAR5E for the new 5E ruleset. There are two approaches to fixing easily: i) is time consuming whilst the other ii) is expensive.
i) Grab yourself a copy of TextMate (similar to Notepad++), cut n paste a paragraph or two of text into TextMate document, select the text in TextMate and select Text->Reformat Paragraph. This will fix the paragraph so that each word is not terminated with a newline.
ii) Grab yourself a copy of Adobe Acrobat Pro. Open the PDF, export to MS Word. Open in Word, export to plain text. Some of the column based text might be mixed up but aside from that I found this method to be the fastest.FG Project Development
Next Project(s)*: Starfinder v1.2 Starship Combat
Current Project: Starfinder v1.1 - Character Starships
Completed Projects: Starfinder Ruleset v1.0, Starfinder Core Rulebook, Alien Archive, Paizo Pathfinder Official Theme, D&D 5E data updates
* All fluid by nature and therefore subject to change.
-
November 5th, 2013, 23:12 #7
- Join Date
- Nov 2010
- Posts
- 328
-
November 6th, 2013, 01:52 #8
- Join Date
- Nov 2010
- Posts
- 328
It worked on the Bestiary and White Plume Mountain but when I followed the instructions and tried to do the same thing on the Against the Slave Lords bestiary, the result is a 1k mod file.
Maybe the formatting in the Slave Lords Bestiary PDF is different?
-
November 6th, 2013, 21:50 #9
I tried to make my regex parsing as tight as I could, but incongruities in format can throw it off. Until I write a better parser. Here's what to fix:
Once you paste the Against the Slave Lords Bestiary from the PDF into Notepad as text.
Before saving it, make these corrections: (it helps to also have the PDF open so you can better understand what you're deleting)
Search for "Raker". Delete from Raker all the way down to the "(+1)" right before Cifal. You'll be deleting Raker and Rat Master.
Delete all the below.
Code:Raker: AC 12; hp 9 (HD 2d8); Dex 14 (+2) Rat Master: AC 11, Dex 13 (+1)
(It's the second Markessa that is found) Her name is in there a bunch of times. She's the one on p.54 of the PDF.
Code:Melee Attack—Short Sword of Speed +1: +8 to hit
Scroll down and delete everything from between and including "Animated Corpses" to the "stunned" right before "Confidential". Lots of Lines
Code:Animated Corpses: When animating spores animate a . . . on the target being able to see. It cannot be blinded, charmed, frightened, paralyzed, or stunned.
Last edited by JamesManhattan; November 7th, 2013 at 21:06.
-
November 7th, 2013, 15:27 #10
I thought when you install Java it automatically adds itself to the Windows PATH.
Here is how to do it manually, which you'll need to do if you want this to run.
https://www.kingluddite.com/tools/ho...y-windows-path
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks