Tokenlab: Pathfinder Herolabs -> Maptools converter

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

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

Forum rules
Discussion regarding lmarkus001's framework only. Other posts deleted without notice! :)
sozin
Cave Troll
Posts: 65
Joined: Sat Nov 25, 2006 8:51 pm
Location: Chicago
Contact:

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by sozin »

Version 0.15 released. It includes the tracked resources stuff discussed above.

Image

The big change here is that I finally bit the bullet and created a Lib:TokenLab library. Additionally there is a ResourcesJSON property that I put on each token to keep the tracked resources. Because of the above, if you have an existing campaign, you'll have to import the LibTokenLab.rptok, TokenLabImageTable.mttable, and TokenLab-Properties.mtprops file into existing campaign. (The .cmpgn file that ships with the zip file already has all of these.)

I also added basic support for d20, and one of my collaborators made the user interface for Mac friendly.

Dracones
Cave Troll
Posts: 68
Joined: Mon Nov 14, 2011 8:04 pm
Location: Fort Pierce, FL

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by Dracones »

Kick donkey. <--- this forum has a weird language filter...

Okay, bugs :)

The last item on a resource list that has multiples will either decrease or increase by 1 when the window is closed and re-opened.

For example, here I brought crossbow bolts up to 8

Image

Close and re-open and it quickly goes down to 7

Image

Now, lower it down to 3:

Image

Close and re-open, and it raises to 4:

Image

Other bug. I bring in a dwarf barbarian and ranger, impersonate and open up the barbarian and add some values.

Image

Now, I'll select the ranger and bring up her resources from the selection tab and add some arrows:

Image

When I go back to the dwarf his resources have been overwritten by the ranger's resource.

Image

I know select/impersonate was a problem with spells too, but I can see this biting people in the donkey during play if they manage multiple tokens.

Also, love the new file selection box on the Tokenlab configure interface. Was a pain before to always have to type in charname.tptok.

sozin
Cave Troll
Posts: 65
Joined: Sat Nov 25, 2006 8:51 pm
Location: Chicago
Contact:

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by sozin »

Thanks, great QA. Definitely something on going on with the differences between currentToken(), getSelected(), and getImpersonated(). I played around with it for a while today and didn't make much progress; this is probably going to take a couple of days :-)

Dracones
Cave Troll
Posts: 68
Joined: Mon Nov 14, 2011 8:04 pm
Location: Fort Pierce, FL

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by Dracones »

Yeah, that entire aspect of maptools might take a bit to wrap around. New weird coding language to learn.

Here's another small nitpick bug from the change in the token file save dialog.

You have a specific behavior(from day 1) that there are token config settings and global config settings. The token settings mean when I go to remake a token, it remembers prior settings for images and the token save path. That's awesome and allows for rapid token remakes on updates. That works fine on the new dialog. Below is a pre-made the the file dialog goes to my token directory:

Image

But when I finish that token up and then start in on a new token it forgets my prior save path and defaults to the application root directory:

Image

I believe what's going on is while you're using the "individual token" config:

Code: Select all

                dialog.setDirectory(config.getTokenFileDirectory());


When that's null you're not falling back to the global prefs. It looks like you used to do this with the old chooser:

Code: Select all

        imageChooser       = new JFileChooser( this.prefs.get(IMAGE_DIR, "" ) );
        tokenOutputChooser = new JFileChooser( this.prefs.get(TOKEN_DIR, "" ) );
        setImageFileChooserFilters(imageChooser);
        setTokenFileChooserFilters(tokenOutputChooser);


But it seems like you're no longer using the JFileChooser tokenOutputChooser in favor of the new FileDialog(which is better).

You do save the TOKEN_DIR in prefs from the dialog, so that should be working fine. But you might need to null check config.getTokenFileDirectory() and pop in the master TOKEN_DIR pref when it's not set.

sozin
Cave Troll
Posts: 65
Joined: Sat Nov 25, 2006 8:51 pm
Location: Chicago
Contact:

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by sozin »

Ok, the above has been fixed (along with added some other UI goodness courtesy of co-developer iamgroot).

Sadly, I am still struggling to fix the impersonate versus selected bug you describe above. Something strange is happening when I try to persist the resources json down to the token. I've put enough time into it now that I must confess the onset of frustration and anguish.

Would appreciate any helpful thoughts on why I'm seeing the saveProperty() function operate on the wrong token - which only happens when you call the macro from an impersonated token; it works just fine if you only call it from selected tokens.

Wall of code below.

[spoiler=TL;DR]Here's the entry macro on the token:

Code: Select all

[h: currentToken = currentToken()]
[h: impersonatedToken = getImpersonated()]
[h, if( currentToken != impersonatedToken): activeToken = impersonatedToken; activeToken = currentToken]
[h: Resources = getProperty( "ResourcesJSON", activeToken )]
[h: args = json.set( "{}" , "ID", activeToken, "Resources", Resources )]


[MACRO("[email protected]:TokenLab") : args ]


The form macro:

Code: Select all


[h: title = "Resources"]
[h: activeToken = json.get( macro.args, "ID" ) ]
Resource frame called on token [r:activeToken]
[h: characterName = getProperty("Character", activeToken ) ]
[h: Resources = json.get( macro.args, "Resources" )]

[IF( json.contains( macro.args, "doSave" ) == 1 ), CODE: {
    persisting token for [r:characterName] ( [r:activeToken] )
    [r:setProperty( "ResourcesJSON", Resources, activeToken )]
}]

[h:ResourceNames = json.fields( Resources )]


[h: imageFormatString =    "<img src='%s' border=0 height=45 width=45 alt='%s'>"]
[h: IncrementImage =    strformat(imageFormatString, tblImage( "TokenLabImages",  2 ),    "Add one to resource used")]
[h: DecrementImage =        strformat(imageFormatString, tblImage("TokenLabImages", 3 ),    "Subtract one to resource used")]
[h: ResetImage =                 strformat(imageFormatString, tblImage("TokenLabImages", 4),    "Reset to zero")]

[frame(title, "input=1; height=100; width=100"):{
<html>
<head>
    <title>[r: title]</title>
    <link rel="stylesheet" type="text/css" href="[email protected]:TokenLab">
</head>
<body>
<h2><br>[r:characterName]</h2>
<br>
<table>
    [FOREACH ( resourceName, ResourceNames, "" ), CODE: {
    <tr>
        [h: upargs   = json.set("{}", "resourceName", resourceName,   "ID", activeToken, "direction", "up" , "Resources", Resources )]
        [h: downargs   = json.set("{}", "resourceName", resourceName,   "ID", activeToken, "direction", "down", "Resources", Resources  )]
        [h: resetargs   = json.set("{}", "resourceName", resourceName,   "ID", activeToken, "direction", "reset", "Resources", Resources  )]
        [h: UpButton = macroLink(IncrementImage,    "[email protected]:TokenLab", "self", upargs )]
        [h: DownButton = macroLink(DecrementImage,    "[email protected]:TokenLab", "self", downargs )]
        [h: ResetButton = macroLink(ResetImage,    "[email protected]:TokenLab", "self", resetargs )]
        [h: used   = json.get( json.get( Resources, resourceName ), "used" ) )]
        [h: max    = json.get( json.get( Resources, resourceName ), "max" ) )]
        <td>[r:DownButton]</td>
        <td><b><font size = "6" >[r:used] </font> </b><font size="3">/[r:max]</font></td>
        <td>[r:UpButton]</td>
        <td>[r:ResetButton]</td>
        <td> <b> [r:resourceName] <b></td>
    </tr>
    }]
</table>
</body>
</html>
}]


And finally the update resource macro:

Code: Select all



[h: resourceName = json.get(macro.args, "resourceName")]
[h: resourceDirection = json.get(macro.args, "direction")]
[h: activeToken = json.get( macro.args, "ID" )]
Update resource called on active token [r:activeToken]
[h: ResourcesJSON = json.get( macro.args, "Resources" )]
[h: Resource =  json.get( ResourcesJSON, resourceName )]
[h: used = json.get( Resource, "used" )]
[h: newValue = 0]


[IF( resourceDirection == "up"), CODE: {
    [h:newValue = add( used, 1 )]
}]

[IF( resourceDirection == "down"), CODE: {
    [h:newValue = subtract( used, 1 )]
}]

[IF( resourceDirection == "reset"), CODE: {
    [h:newValue = 0]
}]

[h:Resource = json.set(Resource, "used", newValue)]
[h: Resources = json.set(  ResourcesJSON, resourceName, Resource )]
returning resource [r: Resources]
[h:Return = json.set( "{}",  "Resources", Resources, "ID", activeToken, "doSave", "1" )]
[MACRO( "[email protected]:TokenLab" ): Return ]


The update macro is working just fine, correctly calling back to the form macro without issue. The place where everything goes wrong is here, from the form macro:

Code: Select all


[IF( json.contains( macro.args, "doSave" ) == 1 ), CODE: {
    persisting token for [r:characterName] ( [r:activeToken] )
    [r:setProperty( "ResourcesJSON", Resources, activeToken )]
}]
[/spoiler]

sozin
Cave Troll
Posts: 65
Joined: Sat Nov 25, 2006 8:51 pm
Location: Chicago
Contact:

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by sozin »

Ok! 0.16 released (download. This should fix the impersonate/selected bug for the resources window. (And for spells as well!) My fix on that was a little cheaty; I basically made it so that you can only run on it on the selected token. if you've selected the impersonated token, it'll work then too. This is a breaking release that will require re-generation of Map Tool tokens.

The default token directory should be fixed - it seems to work for both mac and win, not sure about *NIX.

There are a couple of improvements on the UI as well, but otherwise this is a minor release.

Right now I'm thinking that I'm close to a 1.0 release, which means I'll fix the campaign properties format, which should mean that folks won't have to regenerate tokens on each tokenlab release.

Dracones
Cave Troll
Posts: 68
Joined: Mon Nov 14, 2011 8:04 pm
Location: Fort Pierce, FL

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by Dracones »

sozin wrote:The default token directory should be fixed - it seems to work for both mac and win, not sure about *NIX.


Yep, works fine for me on Linux. Everything else also works, except for the spells link on the spells list window. That's still hard linked into the impersonate token.

Image


Do you plan on handling spell memorization and cleric/sorc spells per day? On the simplest level, they could just be tracked resources:

Code: Select all

<spellclass name="Wizard" maxspelllevel="1" spells="Spellbook"><spelllevel level="0" maxcasts="3" used="3"/><spelllevel level="1" maxcasts="2" used="2"/></spellclass>

<spellclass name="Sorcerer" maxspelllevel="1" spells="Spontaneous"><spelllevel level="0" unlimited="yes" used="0"/><spelllevel level="1" maxcasts="6" used="0"/></spellclass>

<spellclass name="Cleric" maxspelllevel="1" spells="Memorized"><spelllevel level="0" maxcasts="3" used="3"/><spelllevel level="1" maxcasts="2" used="2"/></spellclass>

sozin
Cave Troll
Posts: 65
Joined: Sat Nov 25, 2006 8:51 pm
Location: Chicago
Contact:

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by sozin »

Eek! Nice bug. Yep, tracked spells are next.

sozin
Cave Troll
Posts: 65
Joined: Sat Nov 25, 2006 8:51 pm
Location: Chicago
Contact:

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by sozin »

0.17 released and ready for download! Lots of nice stuff in this release. Includes:

0) Bug fix for above mentioned spell breadcrumb token permission bug.

1) An improved user interface.

Image

Note that iamgroot (who did this code) has added some new right mouse click options. the 'Configure using portfolio defaults' option asks TokenLab to search through the default pog and portrait folders and find any images that match the character name of the token. this is a big time saver of your image file names match the character name, as you can do this as a bulk operation.

2) Cleaned up MapTool main interface.

Image

I wanted more screen realestate with the spell resources, so I made the basic resources more slimmed down.

3) Spontaneous Spells

If your PC/NPC has spontaneous spells, they'll show up in the Special Resources section:

Image

When you click the Spontaneous Spell Resources button, you get a new dialog:

Image

If you have more than one spontaneous spell casting class, both while show up here. Hitting the Reset all link will send everything down to zero.

4) Memorized Spells

If your PC has memorized spells, they'll show up in the Special Resources - Memorized Spells section. My implementation here is a little hackish: a basically create a button for each level of memorized spells your character knows. (I did this because performance was atrocious when I put them all onto one form. It was taking 5+ seconds to redraw the form.) When you click on one of the spell level buttons you get:

Image

As a bonus, I added a spell reference link, so if you click on the spell name it brings up the spell reference, with a breadcrumb back to the memorized spell form:

Image

Finally, if your PC/NPC has rested and you want to reset all of their memorized spells, just click the red 'Reset all' button.

And that's it! Dracones, I'd love for you to bang around and try to break it before I announce the release on the other forums (paizo.com, etc). Happy New Year!

Dracones
Cave Troll
Posts: 68
Joined: Mon Nov 14, 2011 8:04 pm
Location: Fort Pierce, FL

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by Dracones »

The default token image logic is good, finds gifs, jpgs and png's. Doesn't seem to work with capitalized extensions under Linux: jpg vs JPG

You also might consider searching for underscores if the import character name has a space in it: AliaElshaw.jpg vs Alia_Elshaw.jpg

But otherwise the above is very very nice.

There's an issue with the memorized spells import that depends on how you have the spells memorized in Hero Lab. Specifically:

Image

VS

Image

In the first example, I have 2 color sprays, but they work fine.

Image

But with the cure light wounds spell, you end up with this on the import which breaks your spell reference hyperlink:

Image

The other thing is there's no 0 level spells tab. Wizards and witches have limited spells per day for this. Sorc and bards are unlimited I think.

And if you could add the ability to delete entries off the memorized spells tab and add entries to it from the spell reference tab, that'd be very handy. That way if a wizard wants to memorized a different spell the next morning, they could delete and add in an entry.

But the way you have the resources setup flows very well. Also, I imported a gestalt wizard/rogue and was happy to see that everything worked out of the box just fine.

The above was all tested with the latest 3.9 version of Herolab, so no worries there that the update has changed the XML.

sozin
Cave Troll
Posts: 65
Joined: Sat Nov 25, 2006 8:51 pm
Location: Chicago
Contact:

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by sozin »

Thank you! Can you send me the herolabs portfolio file with the Cure light Wounds x2 in it (or explain how you did it)? sozinsky at gmail dot com is the email address if you just want to send it over.

re: level 0 spells - right, duh, forgot about witches and wizards. will fix that asap.

re: spaces->underscores in the regex - yeah, should be an easy change, good idea.

re: allowing wizards to move around their memorized spells based on the spellbook - good idea, will backlog it. I'll be honest, I don't find programming in MapTool's macro language very fun, and so everytime I think about having to do something actually interesting with the language (like what you are describing), something inside me dies in a little :-( I can't wait for native javascript support.

Getting closer to a 1.0 rollout!

Dracones
Cave Troll
Posts: 68
Joined: Mon Nov 14, 2011 8:04 pm
Location: Fort Pierce, FL

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by Dracones »

Portfolio's sent.

But basically how you create the issue is via

Image

In Herolab I've chosen to memorize that spell twice, hence the x2 part.

The xml looks like:

Code: Select all

<spellsmemorized><spell name="Cure Light Wounds (x2)" level="1" 

sozin
Cave Troll
Posts: 65
Joined: Sat Nov 25, 2006 8:51 pm
Location: Chicago
Contact:

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by sozin »

You also might consider searching for underscores if the import character name has a space in it: AliaElshaw.jpg vs Alia_Elshaw.jpg


Will do this in the 0.19 release.

The other thing is there's no 0 level spells tab. Wizards and witches have limited spells per day for this. Sorc and bards are unlimited I think.


Same.

But with the cure light wounds spell, you end up with this on the import which breaks your spell reference hyperlink


Fixed!

Dracones
Cave Troll
Posts: 68
Joined: Mon Nov 14, 2011 8:04 pm
Location: Fort Pierce, FL

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by Dracones »

Another quirk from the previous 4e framework Tokenlab was based on. With critical hits it's only rolling x2 damage. For example, on a longbow attack(crit x3) a natural 20 should see the normal 1d8 damage roll with a 2d8 "critical damage" roll.

I also have up the redone tutorial for Tokenlab: http://tarsis.org/?p=55&preview=true

Better resolution and down to 330 megs using shockwave flash.

sozin
Cave Troll
Posts: 65
Joined: Sat Nov 25, 2006 8:51 pm
Location: Chicago
Contact:

Re: Tokenlab: Pathfinder Herolabs -> Maptools converter

Post by sozin »

Ok, version 18 is released. It includes 3 things:

1) It now properly does critical hit multipliers (x3, x4, etc)
2) If a (N)PC name has a space in it, it'll turn the token name in $FIRSTNAME UNDERSCORE $LASTNAME, for example "Derrak_Stoneskull".
3) Fixed a funny bug that Dracones found parsing the rust monster damage dice

Post Reply

Return to “[D&D3.5 + Pathfinder] Campaign Macros”