Edit Multiple Tokens Property

Talk about whatever topic you'd like, RPG related or not. (But please discuss things related to our software in the Tools section, below.)

Moderators: dorpond, trevor, Azhrei

Post Reply
User avatar
AriesBreath
Cave Troll
Posts: 32
Joined: Thu May 02, 2019 10:37 am

Edit Multiple Tokens Property

Post by AriesBreath »

Hello, I am new to MapTool. I find it is very very versatile but sometimes there is something a little tricky or missing.

In this case, I am searching for a way to edit a property of multiple tokens together. I would like to select some tokens on my map, press Edit and, say, set the Strenght property to 14 for all of them.

This would be useful in case some tokens have something off and I need to replace something for all of them, instead of select one by one and edit that property.

The problem is that if I select more than one token, MapTool doesn't let me edit them, so how can I do it? Maybe some macro but aside from some super simple macros I can't write them.

User avatar
aliasmask
Deity
Posts: 8667
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Edit Multiple Tokens Property

Post by aliasmask »

You could write a temporary macro to set the properties of the token in the Campaign Window. Make sure "apply to selected" is checked.

For example:

Code: Select all

[H: setProperty("Strength",14)]
You could then select all the tokens and run the macro.

User avatar
AriesBreath
Cave Troll
Posts: 32
Joined: Thu May 02, 2019 10:37 am

Re: Edit Multiple Tokens Property

Post by AriesBreath »

Thanks, I would have preferred if MapTool let edit all at once but I'm ok with that.

SUPER EDIT:
I edited this post many times writing my progressions on this macro, everytime with a different problem.
Now I can finally say, IT WORKS.

This is the code, make sure the "Apply to selected token" is unchecked

Code: Select all

[h:input(
"Filter|Yes,No|Filter - Apply the edit only to those tokens with a common property value?|RADIO|SELECT=0 ORIENT=H",
"CommonProp||Common Property - Name of the common property",
"CommonPropValue||Common Property Value - Value of the common property",
"PropEdit||Property To Edit - Which property will be edited",
"PropEditValue||Value To Insert - Value to put in the property")]

[h: json = getSelected()]

[if(Filter == 0),CODE:
{
   [h, foreach(character, json), CODE:
   {
      [h: switchToken(character)]
      [h, if(getProperty(CommonProp)==CommonPropValue): setProperty(PropEdit,PropEditValue)]
   }]
};
{
   [h, foreach(character, json), CODE:
   {
      [h: switchToken(character)]
      [h: setProperty(PropEdit,PropEditValue)]
   }]
};]
It works like this:
1) Select multiple tokens on the map.
2) Run the macro.
3) The macro will ask some input.
3.1) Filter: It asks if you want to apply the edit only to those tokens with a common property value. This is useful if you don't want to manually select only some tokens and lets you select every token instead, then filter them by a common property that the tokens you want to select have (for example it could select every token that have a Strength property of 10). If you select "No", the macro will edit every token and you will not need to compile the next two fields.
3.2) Common property (only if Filter is Yes): the macro asks by what property name you want to filter in the tokens that will be edited.
3.3) Common property value (only if Filter is Yes): the value of the chosen common property. Is useful because maybe every token have a Strength property, but not every token have a 14 value on that property.
3.4) Property to edit: which property you want to edit.
3.5) Value to insert: the value that will be put in the property.
4) Profit. The macro will edit only the selected property with your value, and only on the tokens that you want.

I think I explained that in an awful way, so I'm writing an example here.

Case 1)
I want to edit the Strength property of all my tokens on the map. Instead of doing it manually one by one, I select them all and run the macro, set "Filter" to "No", leave "Common property" and "Common property value" blank (or whatever, it doesn't matter), set "Property to edit" to "Strength" and "Value to insert" to "15" and press Ok. Bum, they all have a property of Strength of 15.

Case 2)
Let's say that I have 30 tokens on my map and that 15 of them are Cultists, positioned randomly between the other tokens. I want to edit the Strength property of all the cultists but not of the other tokens, but I don't want to search and select them one by one either, so I select every token on my map (or only some of them if I want to exclude some) and run the macro, it will filter out the tokens I don't want to edit for me. Let's say that every cutist have a Constitution property of 11 and that every other token have a Constitution property that is not 11.
I run the macro, set "Filter" to "Yes", set "Common property" to "Constitution" and "Common property value" to "11", set "Property to edit" to "Strength" and "Value to insert" to "15" and press Ok. Bum, all the cultists have a Strength property of 15,but the other tokens are untouched.

This is particularly useful if every tokens have a property that represents their class, race, monster name or others. This way you can edit a specific property only of all the paladins, leaving alone the Fighters and the Wizards for example.

I hope I explained myself and that the macro will be useful to someone. Special thanks to Aliasmask

Post Reply

Return to “General Discussion”