PF statblock importer
Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice, lmarkus001
Forum rules
Discussion regarding lmarkus001's framework only. Other posts deleted without notice!
Discussion regarding lmarkus001's framework only. Other posts deleted without notice!
Re: PF statblock importer
Are you copying the stat blocks directly from the PFSRD?
Re: PF statblock importer
I will answer my own question...........yesharchunk wrote:Are you copying the stat blocks directly from the PFSRD?
wow!!! pretty sweet I copied a gobo and it saved me about 20 mins of work.
YOU DA' MAN
Re: PF statblock importer
I am using ver1.6 and it has been a HUGE timesaver. Thank you!!!!
Re: PF statblock importer
There's a 1.8 floating around; I think it's included in Neofax's "Pathfinder Framework" configuration.
Re: PF statblock importer
Thanks for the head's up!Azhrei wrote:There's a 1.8 floating around; I think it's included in Neofax's "Pathfinder Framework" configuration.
Re: PF statblock importer
Can someone help me with a regular expression that will parse out multiple damage reductions and energy resistances in a statblock? Here is an example:
What I need is a way to pull 10, good then 5, slashing and 15, cold and 15, fire.
Code: Select all
Defensive Abilities Bravery +0, Channel Resistance +4, Ferocity; DR 10/good, 5/slashing; Immune Undead Traits; Resist cold 15, fire 15; SR 16
Re: PF statblock importer
What does full resistance via DR look like? Would it be -/slashing, for example?
In these examples I'm using a double-backslash as I expect these are being put into one of the MT regex functions and they require the backslash be protected by another backslash.
Try this regex to extract the DR (the first four characters turn off case-sensitivity; you may or may not want that depending on your incoming data):
And this one to extract the resistances:
There are some assumptions made in the above based on the sample you posted, so if you find that they do not work for a given input just post the sample data and we can update the RE.
I haven't tested either of these, but I think they're pretty darn close.
In these examples I'm using a double-backslash as I expect these are being put into one of the MT regex functions and they require the backslash be protected by another backslash.
Try this regex to extract the DR (the first four characters turn off case-sensitivity; you may or may not want that depending on your incoming data):
Code: Select all
(?i)\\bDR (\\d+)/(\\S+)(,(\\d+)/(\\S+))*\\b
Code: Select all
(?i)\\bResist (\\w+) (\\d+)(,(\\w+) (\\d+))*\\b
I haven't tested either of these, but I think they're pretty darn close.
Re: PF statblock importer
Thanks Azhrei! They both work for grabbing 2 resistances or reductions, but if there are more say 5? Would I need to do a FOREACH? Also, yes the all normally is a -/damage reduction(however it could be an em-dash).Azhrei wrote:What does full resistance via DR look like? Would it be -/slashing, for example?
In these examples I'm using a double-backslash as I expect these are being put into one of the MT regex functions and they require the backslash be protected by another backslash.
Try this regex to extract the DR (the first four characters turn off case-sensitivity; you may or may not want that depending on your incoming data):
And this one to extract the resistances:Code: Select all
(?i)\\bDR (\\d+)/(\\S+)(,(\\d+)/(\\S+))*\\b
There are some assumptions made in the above based on the sample you posted, so if you find that they do not work for a given input just post the sample data and we can update the RE.Code: Select all
(?i)\\bResist (\\w+) (\\d+)(,(\\w+) (\\d+))*\\b
I haven't tested either of these, but I think they're pretty darn close.
Re: PF statblock importer
They will work with any number with a minimum of one. Yes, you will need a loop to process additional ones. The info for the regex functions on the wiki should give some information although IIRC they were pretty sparse. I think you need to loop through the "match groups" and then within each match group there will be a number and a string.neofax wrote:Thanks Azhrei! They both work for grabbing 2 resistances or reductions, but if there are more say 5? Would I need to do a FOREACH? Also, yes the all normally is a -/damage reduction(however it could be an em-dash).
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: PF statblock importer
I'm using a modified version of this importer but I've run into a problem.
Pathfinder statblocks use a "–" for a "-" ... and I've run into a problem where MT doesn't see the two being the same. So, for example, if a monster has a "–1 init", when I try to roll initiative for them I get "12–1" instead of "11".
I tried doing a simple replace (– with -) in the statblock string but MT throws an error so I must have the syntax wrong.
So, assuming my statblock string is called statBlock, how would I make the above replacement?
Pathfinder statblocks use a "–" for a "-" ... and I've run into a problem where MT doesn't see the two being the same. So, for example, if a monster has a "–1 init", when I try to roll initiative for them I get "12–1" instead of "11".
I tried doing a simple replace (– with -) in the statblock string but MT throws an error so I must have the syntax wrong.
So, assuming my statblock string is called statBlock, how would I make the above replacement?
Last edited by Full Bleed on Tue Sep 25, 2012 11:41 pm, edited 1 time in total.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: PF statblock importer
I handle this by copying all of the stablocks to notepad++ in one text file and then strip them from all of the special characters.
Time-Zone information UTC -5
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: PF statblock importer
I would like to avoid doing that. I'm hoping that there is a way to use replace() in MT...neofax wrote:I handle this by copying all of the stablocks to notepad++ in one text file and then strip them from all of the special characters.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
- CoveredInFish
- Demigod
- Posts: 3104
- Joined: Mon Jun 29, 2009 10:37 am
- Location: Germany
- Contact:
Re: PF statblock importer
Maybe this will help you? I dont know a thing about the statblock importer, so I cant guide you on hacking it. But this is the way to replace weird characters.Full Bleed wrote:I'm hoping that there is a way to use replace() in MT...
Code: Select all
<!--
encoded dash sign = %E2%80%93
minus sign doesnt get encoded
-->
[h: input("sampleString")]
ENCODED = [r: sampleString = encode(sampleString)]<br>
REPLACED = [r: sampleString = replace(sampleString, "%E2%80%93", "-")]<br>
DECODED = [r: decode(sampleString)]
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: PF statblock importer
Nice work.CoveredInFish wrote:But this is the way to replace weird characters.
As always... thanks!
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: PF statblock importer
I was thinking any non-ascii characters are not submitted correctly through the form submit. But, I think you can add something to the java line to enable unicode characters. Otherwise, all those special characters are just passed as squares, I think.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools