PF statblock importer

Discussion concerning lmarkus' campaign framework for D&D3.x and Pathfinder.

Moderators: dorpond, trevor, Azhrei, giliath, Gamerdude, jay, Mr.Ice, lmarkus001

Forum rules
Discussion regarding lmarkus001's framework only. Other posts deleted without notice! :)
Imper1um
Cave Troll
Posts: 92
Joined: Mon Sep 28, 2009 7:46 am

Re: PF statblock importer

Post by Imper1um »

Why don't you just ask the user anything if you're unsure about some stuff? I'd rather be asked if a Weapon if Primary/Secondary, Manafactured/Natural rather than you guessing and I have to fix it later. :P

User avatar
lmarkus001
Great Wyrm
Posts: 1867
Joined: Sat Mar 29, 2008 12:30 am
Location: Layfayette Hill, PA

Re: PF statblock importer

Post by lmarkus001 »

Aye, what is stored is an attack set, not a weapon.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: PF statblock importer

Post by Azhrei »

Found another bug this evening -- crossbows need to have the Str bonus to damage capped at 0. My group gotten sliced up by a couple of large light crossbows until I realized that the Str bonus was being added in!

I'd like to see the modifier property name moved into the SkillsJ property instead of having to look it up in the SkillStat string list (this is part of the framework). Unfortunately, that's probably a pretty intrusive change requiring little snippets of updates all over the place. :roll:

User avatar
mosat
Giant
Posts: 143
Joined: Tue Dec 05, 2006 4:41 pm

Re: PF statblock importer

Post by mosat »

Hi All,
I've been looking for ways to get PCGen data into MapTool. I've made output sheets that will export to InitiativeTool but was disappointed to find that although you can export a token from InitiativeTool it does not seem to transfer any of the InitiativeTool properties into MapTool token properties. So far this statblock imported is the best thing I've found for the job. I've created a simple PCGen outputsheet formatted in this specific statblock configuration and it seems to work well with the macro. This is nice because we've recently completed entering the Pathfinder Bestiary, so any creature in it can now be easily generated, exported and pasted into MapTool. I've put this sheet up in my gallery for anyone interested, its the one named "csheet_statblock_to_token".
~ Eddy Anthony (MoSaT)
~ PCGen Data, Docs & Tracker Chimp
~ Outputsheet Tamarin & Mac build guru

neofax
Great Wyrm
Posts: 1694
Joined: Tue May 26, 2009 8:51 pm
Location: Philadelphia, PA
Contact:

Re: PF statblock importer

Post by neofax »

Is there a way that I can change the macro to put the actual name in the GM Name line and the creature type in the Name line? I would rather have the players do Monster Knowledge checks than knowing it is a Otyugh/Beholder/Mind Flayer... Also, is there a way to input Knowledge/Craft/Profession/Perform Skills automatically? I really love the work so far as it basically only takes like 5 minutes to make a token.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: PF statblock importer

Post by Azhrei »

IIRC the statblock macro doesn't handle skill names with embedded spaces, so "Knowledge (Arcana)" won't work, nor would "Escape Artist".

Hmm, maybe that's not true. It might be that the punctuation doesn't work. I know I found a problem and the only fixes I had were not very convenient at all so I ignored it. :roll:

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: PF statblock importer

Post by Full Bleed »

I've been customizing the statblock2token macro for my framework and I was wondering if someone knew a way to grab the HP values inside the parenthesis using strfind?

That is, if the statblock reads:

hp 80 (7d10+42)

I'd like to be able to grab the "7d10+42" value.

That way I can quickly randomize the hitpoint values of monsters I drop into the game instead of using the default values (which are usually pretty weak.)
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

neofax
Great Wyrm
Posts: 1694
Joined: Tue May 26, 2009 8:51 pm
Location: Philadelphia, PA
Contact:

Re: PF statblock importer

Post by neofax »

This is kinda cheesy and very ineffecient as it is my first Regular Expression, but it works:
\([0-9]{1,4}[d][0-9]{1,2}\+[0-9]{0,4}\)

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: PF statblock importer

Post by Azhrei »

Yeah, the real answer requires a loop as you can't know how many of the "d" die rolls there will be. And I don't know how the match functions work with repeated regex groups:

[(]([+]?(\\d+)d(\\d+))+([+](\\d+))?[)]

Note that I used brackets around literal characters instead of a double-backslash. I find that it's sometimes easier to read. I also allowed a leading "+" in the first field since that made the rest of the regex shorter. And the letter "d" requires at least one digit in front of it -- which all statblocks I've seen include, so it shouldn't be a problem.

Maybe not in this case. Here's the same regex using the backslashes instead:

\\(\\+?((\\d+)d(\\d+))+(\\+(\\d+))?\\)

Both of those are untested. But they should handle the following:

7d10+12
1d8+3d6+14
6d12
+8d6

The problem is that the string "1d8+3d6" will match the first group twice and I don't know how that is returned by the string matching code. Testing would be required.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: PF statblock importer

Post by JamzTheMan »

Couldn't you simply use the following?

Code: Select all

(.*)
I mean, you really don't need to parse out the dice right because you'll be passing the notation to MT and MT already handles all of those permutations and will simply roll those dice, right?

And the above keeps the ()'s but that shouldn't be a problem as [(1d8)] rolls just as well as [1d8].

Of course, I may be missing something in that particular macro?
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: PF statblock importer

Post by Azhrei »

Oh man, now he got ME!!!

Very good, Jamz. :)

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: PF statblock importer

Post by Full Bleed »

Ok, going to need some more specifics on the (.*) method.

The code is this:

Code: Select all

[H: id = strfind(statblock, "hp ([0-9]+).+?([0-9]+)")]
[H, IF(0<getFindCount(id)),CODE:
{ 
  [HP=getGroup(id, 1, 1)]
  [HPmax="[R: max(Level, ( "+(HP-ConB*Level)+" + (ConB * Level) ) )]"]
  [HD=getGroup(id, 1, 2)]
  [Level = max(1,HD)]
  [output=output+"HP: "+HP+", HD: "+HD+"<br>"]
}]
Where I thought the (.*) would go just ended up grabbing most of the rest of the stat block and sticking it in the HD prop.



And, here is another issue.

When there are multiple resists, only the first one imports and appends to the DR property using this code:

Code: Select all

[H: id = strfind(statblock, "Resist (\\w+) (\\d+)")]
[H, IF(0<getFindCount(id)),CODE: {
  [resist = getGroup(id, 1, 1)+" "+getGroup(id, 1, 2))]
  [DR=DR+" Resist "+resist]
  [output=output+"Resist: "+resist+", "]
  }]
The types of resists are: Acid, Cold, Electricity, Fire, Sonic

A multiple entry of resists in the statblock might look like:

Resist acid 20, electricity 20, fire 20;


Edit: I'll actually be putting the resists in a token property that looks like:

Resist: Acid=0; Cold=0; Electricity=0; Fire=0; Sonic=0;

But once I know how to deal with the case used in this macro, I should be able to apply it to my own framework.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: PF statblock importer

Post by Full Bleed »

Full Bleed wrote:Ok, going to need some more specifics on the (.*) method.

*snip*
I couldn't get any of the suggestions made to work, so after some gnashing of teeth, I figured out something that works for me:

Code: Select all

[H: id = strfind(statblock, "hp ([0-9]+).(\\((.+)\\))?.?Fort")]
[H, IF(0<getFindCount(id)),CODE:
	{ 
		[HP=getGroup(id, 1, 1)]
		[MaxHP=HP]
		[HD=getGroup(id, 1, 2)]
	}
]
Note, I cut some stuff out that was in the original since I didn't need it and I'll put in an option to evaluate the HD if I don't want to use the statblock's default.



If anyone want to take a shot at the multiple resists issue mentioned above, please do!
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: PF statblock importer

Post by Azhrei »

Unfortunately I can't work on this, but here are some random thoughts I've had about this tool. (Btw, a big ThankYou to Cosworth on such a useful macro!)

One thing I've noticed about the importer is that it doesn't adhere to the convention of using punctuation to denote fields. For example, your Resist entry ends with a semicolon. In fact, every field should end with a semicolon except the last one in a group. So for something like Resist, it might be good to match against "Resist (.*);" so that the entire list of resistances is retrieved, then process them one at a time using the comma delimiter (which means they can be processed as a normal string list).

The problem is that the last element in any section may not have the semicolon. I think the best way to handle that would be to look for all of the section headings (OFFENSE, SPECIAL ABILITIES, etc) and add a semicolon in front of them. Plus add a semicolon to the very end of the string.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: PF statblock importer

Post by JamzTheMan »

Also note, you may need to use \(.*\) instead.

( and ) are special characters and since you are specifically looking for a ( you need to escape it. I do most of my quick testing in TextPad (has a great regExp search/replace) but MT parser may differ from TextPad's.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

Post Reply

Return to “D&D 3.5/Pathfinder 1e Campaign Macros”