TokenMaker

We are always looking for new tools to create to help facilitate the table top gaming experience. Let us know if you have an idea for a new gaming tool you'd like to see. (Note: this is NOT for feature requests on existing tools!)

Moderators: dorpond, trevor, Azhrei

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

If I make a noddy macro on a monster token and put this in it:

Code: Select all

[macro("RollInitiative@Lib:Blakey"): token.name]
then on clicking it the whole thing works fine. That's the exact same code as gets called from the frame effectively, but that fails.

:(
The guy in the green hat.

Thanlis
Giant
Posts: 240
Joined: Tue Mar 24, 2009 3:34 pm

Re: TokenMaker

Post by Thanlis »

I can't be much technical help here but I wanted to let you guys know I'm following this avidly. :)
Reed (halfling sorcerer P3) // Collin (human fighter P2) // Cine (eladrin psion H2)
Sirath (deva shaman H1) // Alesk (dragonborn cleric H3) // Kevin (halfling barbarian H1)

RGCrab
Kobold
Posts: 20
Joined: Mon Jun 07, 2010 6:20 pm

Re: TokenMaker

Post by RGCrab »

Code: Select all

[MyName= getStrProp(macro.args, "Name")]
[h,token(MyName): addToInitiative()]
If I'm reading that correctly, you will be pulling out the name of the token without quotes. token() requires quotes last I checked. Maybe try something like this?

Code: Select all

[MyName= getStrProp(macro.args, "Name")]
[H, token('"' + MyName + '"'): addToInitiative()]
I know that solution has worked with some of the more hacky things I've done.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: TokenMaker

Post by Rumble »

No, token doesn't require quotes - I can run that macro fine when I test it.

I don't know why it's not working for Blakey, though. Blakey, you could also try switchToken() (e.g., switchToken(MyName) ) to change the current token. Also, are you sure it is getting the name properly from the string property?

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Hmmm, weirdness here. The name seems to be getting confused somehow. I'll try and show all I have:

1. Property on the token:

Code: Select all

*@SheetLauncher:[macro("DisplayStats@this"):token.name]
The fires the macro 'DisplayStats' on mouseover, passing the name of the token as a param.

2. DisplayStats macro:

Code: Select all

[H:tokenName  = json.get(macro.args, 0)]
[frame("MonsterStatCard"): {
<p> MY HTML HERE </p>
}]
3. Inside the HTML I have links which look like this:

Code: Select all

<b><a href="macro://RollInitiative@Lib:Blakey/all/TOKEN?Name=[tokenName]">Initiative</a></b> +7
This makes a link on the HTML frame which fires the RollInitiative macro passing the tokenName as an argument

4. RollInitiative macro looks like this:

Code: Select all

[MyName= getStrProp(macro.args, "Name")]
[h,token(MyName): addToInitiative()]
This then errors when I click the Initiative link on the HTML frame. Basically the TOKEN(name) call is not working at all.


I have been digging into the way I'm getting the tokenName in the original DisplayStats macro and I might have a problem there. If I make the macro DisplayStats just this:

Code: Select all

[H:tokenName  = json.get(macro.args, 0)]
<[tokenName]>
then rather than seeing "<Goblin>" as I'd expect on the pop up screen, I get "<tokenName=Goblin Goblin>". I'm going to check into how I'm reading those arguments in DisplayStats. I think that's my problem.
The guy in the green hat.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

There is something HUGELY wrong here. I have a macro which looks like this:

Code: Select all

[H: name=getStrProp(macro.args, "Name")]
I am called "[name]" <br/>

[H:Targets = getTokens()]
[FOREACH(target, Targets, "<br>"), CODE: {
	He is called "[getName(target)]" - 
	[if (name == target), code : {
		Found me!
	};
	{
		That is not me.
	};]
}]
So what that does is gets the name of the token from the macro args "Name", then goes through all the tokens on the map and prints their names. Then it compares their name to the name we grabbed and sees if they are the same. Obviously one token SHOULD match. None do. Eh?

The output I'm getting looks like this (there are three tokens on the map called 'a', 'b' and 'c'):

Code: Select all

Blakey: I am called "b"
        He is called "a" - That is not me. 
        He is called "b" - That is not me. 
        He is called "c" - That is not me.
How can that make sense? The only difference is that if you mouse over each of the "a","b" and "c" bits on the chat window you see that the names are calculated differently.

This is really getting annoying now.
The guy in the green hat.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Cracked it!!!!! Sneaky little bugger of a bug.

The problem was inside my Frame HTML. This bit:

Code: Select all

<a href="macro://RollInitiative@Lib:Blakey/all/TOKEN?Name=[tokenName]">Initiative</a>
Needs to look like this:

Code: Select all

<a href="macro://RollInitiative@Lib:Blakey/all/TOKEN?Name=[r:tokenName]">Initiative</a>
The difference is that "Name=[tokenName]" should be "Name=[r:tokenName]" otherwise a whole bunch of hidden extras get sent in with the macro as Name.

Now I'll see if I can get some macros fired off the HTML frame...
The guy in the green hat.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

More problems. All these are with MapTool macros now, not TokenMaker. This is definitely a macro question so I posted it HERE but am linking here for info.
The guy in the green hat.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Okay. Cooking on gas. The solution to the last problem,and in fact a much simpler solution than I had been trying, was the use of macroLink. Massive thanks to Craig for suggesting this. I know Rumble suggested that way back - I wish I'd taken his advice. I assumed that adding direct HTML code into the frame would be as good as anyting else I could do. Turns out I was wrong.

Critically, by adding macroLink commands into the HTML you can pass a target argument to the function. This target (which I'm pretty much always passing as "currentToken()") is the token that the macro gets executed on. And, vitally, this translates to sub-macros too. This means no need to pass the token name about from macro to macro - they all just work as if executed on the current token - i.e.the one who "owns" the frame. Perfect.

I've just knocked up links for Initiative, healing, damage, saves, action point use that all directly call the low level macros on my library and work without any modifications needed to the existing library macros. This is a great step forward.

Today I also managed to get the names of the powers on the PC frame to work as links. When clicked they display the power description from the compendium in a separate frame. Sweet for in-game access to the info you need.

Only thing really missing from my PC sheet now is character specific stuff. e.g. How do you add sneak attack on easily for the rogue? How do you allow the cleric to click his "Healing Word" macro and have it automatically roll the right number of dice. Something to think on this weekend whilst I'm off camping.

Have a good one all!
Blakey
The guy in the green hat.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

A quick update.

I've worked hard on TokenMaker again this week. I've progressed the Blakey framework alongside it and the two are working hand in hand really well. Probably going to try them out in anger in my game as soon as the current fight (we are half way through and which is using Veggie) is over. We play tonight so it might get used in anger later today.

Basically, I have refactored more of the code, meaning that all the token generation code is in one place, which should make it (relatively) easy for someone to extend to support other framworks.

I've also greatly increased my parsing of the monsters, meaning I can now build the monster's HTML frame myself, having it look very similar to the default HTML but adding little touches I find useful like having at will powers displayed in green, encounter powers in red and rechargables in yellow.

I've managed (thanks to Rumbles awesome suggestion of a few posts back) to get powers to change colour on the character sheet when used - and this works for monsters as well as players, and to return to the right colours after a rest.

I have picked up any healing bonuses a character has which automatically come out in chat when you use a healing power. That's all taken off the PC save file still, which is great news as there is zero special configuration you need to do.

I have managed to implement sneak attack as a specific ability, again, if you have it, TokenMaker knows about this ability and my new framework supports it.

I'm not 100% happy with the way I'm dealing with Sneak Attack, simply because it is so specific to that power, but it's one I needed to work for my campaign so I sorted it out.

I'm due to be running an entire weekend of D&D the week after next where the framework will get a serious workout - once that is done and any bugs worked out, I think I'll probably release it to the wild and see if anyone wants to use it.

Current problems I see with TokenMaker:

1. It doesn't know about extra damage weapons do when they crit. This info is not in the save file and I'm not sure where to get it from yet.
2. If you deselect some of the source book options for a PC and save it, the Character Builder generates badly formed XML and the DOM XML parser I'm using coughs on it. Not sure if I can do anything about that unless I can extend the DOM parser to cope with the wierd stuff CB generates.
3. When the monster html is reworked this month, my monster parser will probably need rewriting. I'm hoping they don't change the HTML tags too much, then it shouldn't be too much of a task.

Just out of curiosity, does anyone out there think they might be interested in trying out my new FW which requires TM to make tokens for it?

Cheers
Blakey

P.S. A big thanks to Rumble for all his help with the last couple of weeks - a lot of what I've been doing has been actually making tokens for my FW which means generating MT macro code on them which I've been struggling with. He's been a great help. :D
The guy in the green hat.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: TokenMaker

Post by Rumble »

Blakey, I'd love to give the framework a whirl. I'm also interested in looking at TokenMaker and seeing if I can extend it; that would r0xx0r my b0xx0rz, as the youth used to say.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Rumble wrote:Blakey, I'd love to give the framework a whirl. I'm also interested in looking at TokenMaker and seeing if I can extend it; that would r0xx0r my b0xx0rz, as the youth used to say.
Are you aware it has a google code repository? I think you could go and download it right now and built it for yourself...

At this precise moment in time it's relatively stable. In fact I just made 2 JAR files, one for NPCMaker.jar and one for PCMaker.jar. These combined with my test campaign would be enough to test it but it would be a massive case of "alpha test - user beware".
The guy in the green hat.

User avatar
AidyBaby
Dragon
Posts: 383
Joined: Tue Feb 07, 2006 12:55 pm
Contact:

Re: TokenMaker

Post by AidyBaby »

Blakey wrote:Just out of curiosity, does anyone out there think they might be interested in trying out my new FW which requires TM to make tokens for it?
I'd love to give this a whirl. (All we'd need to do now is beg Rumble to configure a mod or somesuch to get TM to create Rumble tokens).

-- AidyBaby --
D&D qualities are related inversely to those of Poker... and I love both.
http://www.yorkpoker.co.uk

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: TokenMaker

Post by Rumble »

Blakey wrote:Are you aware it has a google code repository? I think you could go and download it right now and built it for yourself...

At this precise moment in time it's relatively stable. In fact I just made 2 JAR files, one for NPCMaker.jar and one for PCMaker.jar. These combined with my test campaign would be enough to test it but it would be a massive case of "alpha test - user beware".
I knew about the source stuff; what I meant was just getting a look at the newly refactored code (can't do that now, but I will later today).

AidyBaby wrote:I'd love to give this a whirl. (All we'd need to do now is beg Rumble to configure a mod or somesuch to get TM to create Rumble tokens).

Someday. I plan on taking a look today at the TM code to see if I can figure it out. Extending it for my framework will be nontrivial no matter what (simply because my character tokens are so complex) but I managed it with the parser I modified from JamesManhattan, so it'll be possible.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Well, it's in the wild.

Go download it, play with it and break it into little pieces. :D
The guy in the green hat.

Post Reply

Return to “Ideas for New Applications”