Raoden's Quick'n'Dirty Token Manager

These are tools and utilities that make it easier to run games. This includes Lib: macro tokens dropped into MapTool to manage the game, a conversion file for CharacterTool to allow use in MapTool, or just about anything else you can think of -- except graphics with macros and anything specific to a particular campaign framework. Those are already covered by the Tilesets subforum and the Links and External Resources forum.

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

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Raoden's Quick'n'Dirty Token Manager

Post by Raoden »

07/06/10: v2.0 uploaded
New features:
  • New user interface, utilizing a frame instead of a dialog. Separate "tabs" in the frame for managing Properties and Macros. Frame is compatible with the new version of my Mood Manager that I'll be releasing soon.
  • JSON Editor hopefully works flexibly, finally.
  • JSON Editor can now edit the order of JSON Arrays, using little "up arrow" and "down arrow" links.
  • Like v1.4, should automatically adapt to your MapTool build when deleting unwanted properties or displaying capitalization of Property names.

07/02/10: v1.4 uploaded
New features: Should detect MapTool build automatically and adapt to new macros available subsequent to 1.3.b63.
In b64 and later builds, this means capitalization of token properties should now be preserved.
In b68 and later builds, this means erasing unwanted properties from the token no longer involves using a "Clone Token."

05/28/10: v1.3 uploaded.
New features: Rumble's Macro Deletion utility; Macro Import/Export functions by CoveredInFish and aliasmask. Links to all these new functions are available in the Property Editor frame.

05/28/10: v1.2 uploaded.
New feature: "delete" unwanted properties (including "hidden" properties) by copying most of a token's information over to a new token, but leaving out unwanted properties. Thank you for getting this started, CoveredInFish.

------------

OK, I wasn't planning to post this as an independent User Creation, as I know there are already some similar things floating around. But there's been some interest expressed in this tool, and as far as I know there isn't currently any other tool on this Forum that has all of this utility.

Instructions
  1. Download the attached token
  2. Place it in your campaign
  3. Copy the main macro -- the red one -- to Campaign Macros
  4. Select or impersonate on the token whose properties you want to edit
  5. Click on the new Edit Token Properties Campaign Macro

Features
  • Interface should be pretty self-explanatory
  • Accesses all of a token's properties, whether defined in Campaign Settings or "hidden"
  • Can work with token properties that use JSON structures (of any reasonable depth). To make a token property into a JSON, or to add a nested layer to an existing JSON, just enter {} or [] when prompted for a value of a property.

One thing I've noticed it can't do is change the order of elements in a JSON array. If such a feature would increase the utility significantly, let me know and I'll work on it.
Attachments
Token Manager v2.0.rptok
(56.75 KiB) Downloaded 736 times
Last edited by Raoden on Tue Jul 06, 2010 4:41 am, edited 8 times in total.
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0


User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Quick'n'Dirty Token Property Editing Dialog

Post by Raoden »

Thanks, CIF.

And, a screenshot.
Attachments
PropEditorDemo.PNG
PropEditorDemo.PNG (194.1 KiB) Viewed 8111 times
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
Full Bleed
Demigod
Posts: 4465
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Quick'n'Dirty Token Property Editing Dialog

Post by Full Bleed »

Nice tool, thanks.

Could you distinguish between which properties are "Hidden"? Maybe make them display in italics if they are?


And since you put this tool together, I figure you might know the answer to this question... I understand that it's impossible to truly "delete" a hidden property (or any property) within MT. Has anyone made something that makes it easier to do that outside MT either directly with an RPTOK file or by selectively reading the right info from the xml file inside the RPTOK file?
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Quick'n'Dirty Token Property Editing Dialog

Post by Raoden »

Full Bleed wrote:Nice tool, thanks.

Could you distinguish between which properties are "Hidden"? Maybe make them display in italics if they are?

That's a good idea. I'll work on it.

And since you put this tool together, I figure you might know the answer to this question... I understand that it's impossible to truly "delete" a hidden property (or any property) within MT. Has anyone made something that makes it easier to do that outside MT either directly with an RPTOK file or by selectively reading the right info from the xml file inside the RPTOK file?

Nope, can't help you myself. I know nothing about XML (yet).
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Quick'n'Dirty Token Property Editing Dialog

Post by CoveredInFish »

Full Bleed wrote: I understand that it's impossible to truly "delete" a hidden property (or any property) within MT.

You could create a new token, copy and set all except the stuff you'd like to delete.

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

Re: Quick'n'Dirty Token Property Editing Dialog

Post by Azhrei »

AFAIK this is the only way to do it within MT.

I'm not inclined to work on fixing this myself, but if someone else wanted to create a patch I'd look at it.

I expect that 1.4 will use a completely different approach to properties (in terms of how they're managed internally) so to me there's not a compelling enough case.

User avatar
Full Bleed
Demigod
Posts: 4465
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Quick'n'Dirty Token Property Editing Dialog

Post by Full Bleed »

CoveredInFish wrote:You could create a new token, copy and set all except the stuff you'd like to delete.


Is there a way to do this with a macro?

The I/O Macro you and Alias made helps with getting all the macros onto a new token, but moving over the other properties can be time consuming.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Quick'n'Dirty Token Property Editing Dialog

Post by CoveredInFish »

I have a macro that makes a complete copy. You'd have to create the UI to select properties to exclude.

[spoiler=duplicateToken]

Code: Select all

[h'<!-- get source and destination via user input -->']
[
htokens getTokens()]
[
hnames ""]
[
h, foreach( idtokens ): names listAppend(namesgetName(id))]

[
hstatus input(
    
strformat("srcIdx|%s|Select source|LIST"names), 
    
strformat("destIdx|%s|Select destination|LIST"names)
)]
[
habort(status)]
[
hassertsrcIdx != destIdx "You must select different tokens.")]

[
hsrc listGet(tokenssrcIdx)]
[
hdest listGet(tokensdestIdx)]

[
h'<!-- set states -->']
[
hallStates getTokenStates()]
[
h, foreach(stateallStates): setState(stategetState(statesrc), dest)]

[
h'<!-- set image -->']
[
htoken(src): image getTokenImage()] 
[
htoken(dest): setTokenImageimage )]

[
h'<!-- copy properties -->']
[
hallProps getPropertyNames(","src)]
[
hexcludeList ""]
[
h, foreach(propallProps), code: {
    [
h, if(listFind(excludeListprop)!=-1), code: {
       [
hsetProperty(propgetProperty(propsrc), dst)]
    };{}]
}]

[
h'<!-- misc  -->']
[
hsetName(getName(src)+" copy"dest)]
[
hsetGMName(getGMName(src), dest)]
[
hsetLabel(getLabel(src), dest)]
[
htoken(src): notes getNotes()]
[
htoken(dest): setNotes(notes)]
[
htoken(src): notes getGMNotes()]
[
htoken(dest): setGMNotes(notes)]
[
h, if( isPC(src)): setPC(dest); setNPC(dest)]
[
hsetSize(getSize(src), dest)]
[
hsetVisible(getVisible(src), dest)]
[
hsetPropertyType(getPropertyType(src), dest)]

[
h'<!-- macros -->']
[
hallMacros getMacros(","src)]
[
h, foreach( macroallMacros ), code: {
    [
hindexes getMacroIndexes(macro","src)]
    [
h, foreach( indexindexes ), code: {
        [
hprops getMacroProps(index"json"src)]
        [
hcreateMacro(propsdest)]
    }]
}]
Token [r:getName(src)] copied
[/spoiler]

User avatar
Full Bleed
Demigod
Posts: 4465
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Quick'n'Dirty Token Property Editing Dialog

Post by Full Bleed »

CoveredInFish wrote:I have a macro that makes a complete copy. You'd have to create the UI to select properties to exclude.


I tried, but ran into problems with properties that had pipes in them and my UI failed. Too much trouble to figure it out.

How do I use the excludeList? I put some property names inside the quotes, separated with commas, and they still copied over. And, strangely, some other properties that I wanted to copy over didn't.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Quick'n'Dirty Token Property Editing Dialog

Post by CoveredInFish »

Hmm .. pipes in property names will be always a problem when you use input(). You could replace them with something and replace them back after the dialog.

The excludeList should be a string list of property names.

All properties retrieved by Wiki: getPropertyNames() should get copied. If Wiki: listFind() returns -1 for a prop vs the excludeList it skips setProperty.
I dont see where this would fail ...

If this topic keeps growing we should stop hijacking this thread :oops:

User avatar
Full Bleed
Demigod
Posts: 4465
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Quick'n'Dirty Token Property Editing Dialog

Post by Full Bleed »

CoveredInFish wrote:The excludeList should be a string list of property names.

Can't get it to work. Can you show me an example of what it should look like?


All properties retrieved by Wiki: getPropertyNames() should get copied. If Wiki: listFind() returns -1 for a prop vs the excludeList it skips setProperty.
I dont see where this would fail ...

It most definitely is not copying over *any* properties for me. The only properties showing on the new token are the defaults. Maybe I'm using it wrong. All I did was put the code into a macro in the Campaign Window. Run it. Selected the token I wantd to copy and the "blank." It says it copied... changed the name of the new token it in the popup. Selected a "blank" for the copy. It seemed to copy everything over by the properties and the vision type.


If this topic keeps growing we should stop hijacking this thread :oops:

Well, I figure if I keep bumping the topic enough, maybe Raoden will think it's a cool idea to turn his "Edit Token Properties" macro into an "Copy/Edit Token Properties" macro by incorporating your code. ;)

But you can go ahead and start a thread with your duplicateToken as a drop-in if you'd like. We can move our discussion there.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Quick'n'Dirty Token Property Editing Dialog

Post by CoveredInFish »

You used it right but i wrote it wrong.

Fixed (it would have copied only props in the excludeList) and added dialog for selecting properties to skip/exclude.

[spoiler=fixed code]

Code: Select all

[h'<!-- get source and destination via user input -->']
[
htokens getTokens()]
[
hnames ""]
[
h, foreach( idtokens ): names listAppend(namesgetName(id))]

[
hstatus input(
    
strformat("srcIdx|%s|Select source|LIST"names), 
    
strformat("destIdx|%s|Select destination|LIST"names)
)]
[
habort(status)]
[
hassertsrcIdx != destIdx ,"You must select different tokens.")]

[
hsrc listGet(tokenssrcIdx)]
[
hdest listGet(tokensdestIdx)]

[
h'<!-- set states -->']
[
hallStates getTokenStates()]
[
h, foreach(stateallStates): setState(stategetState(statesrc), dest)]

[
h'<!-- set image -->']
[
htoken(src): image getTokenImage()] 
[
htoken(dest): setTokenImageimage )]

[
h'<!-- copy properties -->']
[
hallProps getPropertyNames(","src)]

[
h'<!-- build dialog -->']
[
hfields ""]
[
h, foreach(propallProps): fields json.append(fieldsstrformat("exclude%s|0|%s|CHECK"propprop))]
[
hstatus input(json.toList(fields"##"))]
[
habort(status)]
[
hexcludeList ""]
[
h, foreach(propallProps), code: {
    [
h, if(eval("exclude"+prop)==1): excludeList listAppend(excludeListprop)]
}]

[
h, foreach(propallProps), code: {
    [
h, if(listFind(excludeListprop)==-1), code: {
       [
hsetProperty(propgetProperty(propsrc), dest)]
    };{}]
}]

[
h'<!-- misc  -->']
[
hsetName(getName(src)+" copy"dest)]
[
hsetGMName(getGMName(src), dest)]
[
hsetLabel(getLabel(src), dest)]
[
htoken(src): notes getNotes()]
[
htoken(dest): setNotes(notes)]
[
htoken(src): notes getGMNotes()]
[
htoken(dest): setGMNotes(notes)]
[
h, if( isPC(src)): setPC(dest); setNPC(dest)]
[
hsetSize(getSize(src), dest)]
[
hsetVisible(getVisible(src), dest)]
[
hsetPropertyType(getPropertyType(src), dest)]

[
h'<!-- macros -->']
[
hallMacros getMacros(","src)]
[
h, foreach( macroallMacros ), code: {
    [
hindexes getMacroIndexes(macro","src)]
    [
h, foreach( indexindexes ), code: {
        [
hprops getMacroProps(index"json"src)]
        [
hcreateMacro(propsdest)]
    }]
}]
 
[/spoiler]

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Quick'n'Dirty Token Property Editing Dialog

Post by Raoden »

Full Bleed wrote:Well, I figure if I keep bumping the topic enough, maybe Raoden will think it's a cool idea to turn his "Edit Token Properties" macro into an "Copy/Edit Token Properties" macro by incorporating your code. ;)

Sure, I'm fine doing that, as long as CIF does all the hard work. :wink:
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
Full Bleed
Demigod
Posts: 4465
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: Quick'n'Dirty Token Property Editing Dialog

Post by Full Bleed »

CoveredInFish wrote:You used it right but i wrote it wrong.

Fixed (it would have copied only props in the excludeList) and added dialog for selecting properties to skip/exclude.


Dangit. Still can't get this to work. I got a prompt for a property value:

Code: Select all

value for excludedamage


I think the problem is that I had a white space in a property called "Damage Reduction." I changed the name in Campaign properties but, of course, it is already on the token incorrectly.

Any way to deal with that? Or am I going to have to go into xml?

Oh yeah, and thanks for the check boxes! :)


Raoden wrote:Sure, I'm fine doing that, as long as CIF does all the hard work. :wink:


Looks like the hard work at this point would be setting up the UI.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Post Reply

Return to “Drop-In Macro Resources”