Some BackgroundI've just started to learn java and so as an intellectual exercise I figured I'd put my skills to practice doing something I might enjoy and that might actually be useful to me when and if I ever finish it. I looked about for projects to get my hands on and I realised that there was an opportunity available for MapTool that I could have a crack at - automated Token Generation.

Me and my pals play D&D 4E. We are currently using MT as our VTT and one of our number lives 250 miles away and dials in, with Skype, to join the games. It works great. I am the DM. I'm also the techie who understands all the technology we are using (although others understand most of it too). But no one else has yet taken up the batton of DMing using MapTool. We use a complicated Framework (a highly modified version of Veggie's) and I use a modified version of James Mastersen's monster cut and paste to generate my monsters. It's relatively simple for me to make PC tokens and Monster tokens but its not as easy as it could be. If I want others in my group to use MT as DMs I'm going to have to explain to them how to build monster and PC tokens using these tools I've cobbled together and hacked. It's not easy.

We all have a DDi subscription, so we all have access to the Compendium and the Character Builder. All our PCs are built from the Character Builder and when making my campaigns I nearly always pick and choose monsters already existing in the Compendium. I have used the Monster Builder to build a few monsters at times too.

So, I thought, if I could make a program which would very simply and easily create PC and Monster tokens for MapTool that would be dead handy. It would also make a good project to play around with for learning Java. Hence TokenMaker was born.

TokenMakerTokenMaker has been designed to do two distinct jobs:1. Make PC/Player tokens.2. Make Monster tokens.I'm going to address both of these separately. Note that TokenMaker is 100% geared towards making 4E D&D tokens and definitely requires a DDi subscription to use.

1. PC TokensWhat I want is a tool that will take an existing DDi Character Builder Save File and generate a Player Token for MapTool. The idea would be simply that you select a ".dnd4e" save file and press build and off it goes. It can get all the basic stats for your PC from there. It can parse out the Powers. It can also get a portrait file - which will be needed to make a token. The only thing missing is the details of what the Powers do. But the program can look that up as we make the token, if we have access to the Compendium inside the program. Press a button and "pop", a token can be made and saved.

2. Monster TokensBuilding monsters is perhaps a little more complicated in places and easier in others. I want the facility to look up monsters by name ("Goblin" for example) and have it throw me up a list to pick from. Click on the name in question and pop up it's stat block. Then pick a portrait file and press a button and "pop", out comes a monster token.

This ThreadThis thread is here for me to report my progress on this task. I'm going to use it to report when I've completed parts of the task and to brain storm ideas for what I want it to do next. Feel free to chip in and help out wth comments and suggests and critque.

My Coding SpeedOne thing I should point out up front is that I'm a busy chap. I have a full time job, a family, I run a D&D campaign which needs a lot of time spent on it, and I have a good social life. I'll spend the odd hour on the PC coding up some java as and when I have the time and feel the desire to do so. So don't expect this project to be finished any time soon. In fact, if it's anything like many of my other projects it may well never get finished.

With each Power I'm capturing their attack and damage stats per weapon equipped.

Things still to do:

Grab their skills

Make a GUI to handle/display all this.

The Whole MapTool side of things (building a MT token with macros for powers, etc, etc).

Basically I have some simple parsing working here and am getting most of what I want out of the save file and into a Object for the PC. I still need to scan Skills and then I'm about there, ready to start looking into how on earth I'm going to output this into an actual MT token.

I've made some good progress on here to date. One thing which has been really tough has been getting access to the Compendium programatically. It is easy to do searches on the Compendium, so getting a list of monsters with the name "Goblin" in them is simple. But actually getting the HTML code for a given monster has been a nightmare. Thanks to the usual very helpful people on this board I have now cracked that hurdle. This is what I have so far:

When you start up TokenMaker and tell it you want to build a Monster it pops up the frame below. You can type something you want into the "Name:" field and press "Find" and it goes off and finds all the monsters matching that name:

Before I can start building actual tokens I need to come up with a final plan for what I'm going to do with respect to Frameworks - if I'm going to make a new Framework to suuport this application or if I'm going to try and build tokens for specific existing Frameworks like Veggies and Rumbles. Much more thought is needed in this area.

The cleanest solution would be to open your tool to support "any" framework - given someone wrote an "exporter class" (or whatever needed) for it. If you think now extendable it shouldnt be so much harder than to write one fixed solution.

I think I'm going to get both the PC and Monster scanning stuff working completely first. So I need to make sure I can get all the info I need from the PC save file and into the PC object. And I need to parse the Monster HTML and get that all stored in my internal Monster object. That's step one really.

Once that is done I have to have a serious think about how I get from my internal classes to actual MapTool tokens. I'm not even thinking about this yet!!

The cleanest solution would be to open your tool to support "any" framework - given someone wrote an "exporter class" (or whatever needed) for it. If you think now extendable it shouldnt be so much harder than to write one fixed solution.

I think I'm going to get both the PC and Monster scanning stuff working completely first. So I need to make sure I can get all the info I need from the PC save file and into the PC object. And I need to parse the Monster HTML and get that all stored in my internal Monster object. That's step one really.

Once that is done I have to have a serious think about how I get from my internal classes to actual MapTool tokens. I'm not even thinking about this yet!!

Well... one option is to serialize the Monster/PC object as an XML document. Then the end user could provide an XSLT to transform the XML content from one form to another based on the token's internal structure (or some other intermediary structure. This would make it fairly simple for thinks like skills, abilities, to be stored no matter what the target framework's property names are. The powers are the big ugly piece here. Some frameworks store the power directly on the token macro, others store a JSON description of the power on the token inside the macro, others store the JSON description in a token property, and others store a JSON description on a Lib token... I am sure there are other combos I am not thinking of right now.

_________________I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

Well... one option is to serialize the Monster/PC object as an XML document. Then the end user could provide an XSLT to transform the XML content from one form to another based on the token's internal structure (or some other intermediary structure. This would make it fairly simple for thinks like skills, abilities, to be stored no matter what the target framework's property names are. The powers are the big ugly piece here. Some frameworks store the power directly on the token macro, others store a JSON description of the power on the token inside the macro, others store the JSON description in a token property, and others store a JSON description on a Lib token... I am sure there are other combos I am not thinking of right now.

I'm well away from getting here still, but I think this is a good idea. I'll probably provide some sort of simple XML output as a first step - using serialize as you suggest. People can then take them and run with them for their own frameworks in the short term.

I definitely want to be able to press a button and have it save a Token out of this tool when I'm all done. I suspect that the most likely approach I'll take here is to make myself a new Framework that this tool generates tokens for. As suggested earlier if I write an interface to represent "tokenizable" (!!!) then anyone can come along later and write a class to implement that interface for their own framework.

This is with the 18th level wizard in my current campaign loaded. As you can see there is a list of all his powers in the middle of the screen and when you mouse over a given power a ToolTip pops up with the stats of that power with his first equipped weapon, for reference (although you can't see all the tool tip on this screen grab). Getting there.

Next up on PCs is to scan in Skills from the Save File and maybe display them on this frame.

Last night I added a little portrait onto the Player Maker frame. This is the default file that is held as the portrait for your PC inside the CB save file. It's enabled as a button so you can click on it and it will pop up a file chooser which will allow you to change the portrait displyed. This doesn't change the portrait on the character builder save file but when the time comes to build a MT token this is the portrait that will be used for the token.

I've now got the PlayerMaker scanning the save file and grabbing out all the PC stats of significance and saving them away, including the skills. So basically I can now read a Character Builder save file and get everything out of it I think I need.

Today I have created a Token class to deal with actually creating a MapTool token. I have written all the code to create all the constituent parts of the token in the right places and then zip them up to make an rptok file. I've added some code to the PlayerMaker frame such that when you click the "Save" button it pops up a dialog box, asking for a save file name (*.rptok). Once that is selected it actually goes off and builds a plain MapTool token. Yay!

Trouble is, if you come to try and use the token inside MapTool it doesn't recognise it as a valid token. That whole side of things needs debugging and fixing up and then I'm at the stage where I can generate tokens from my saved PC files. Of course the tokens I'm creating have no MT Properties or Macros on them yet so we have a LONG way still to go.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum