I know I saw how to do it (think I did do it as an exercise a few weeks ago) but I can't find it now.
How do I set a macro to count how many tokens with a given "thing" (specifically a certain gm name) exist. Not majorly important, but I have a map that needs a set number of three types of token and counting them (they don't appear in a nice pleasing order) is a pain.
I get the feeling I'm going to have one of *those* moments when I see the answer.
token of "name" count
Moderators: dorpond, trevor, Azhrei
Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
token of "name" count
Still learning macros, so anything in my code I could do in a simpler way would be appreciated.
Re: token of "name" count
assuming the 'thing' is a token state its something like:
Code: Select all
[h:toks = getTokens(",", json.set("{}","setSTate", "Thing", "layer", json.append("[]","TOKEN","HIDDEN","OBJECT","BACKGROUND")))]
[h:numToks = listCount(toks)]
[r:"Number of tokens with 'thing': " + numToks]
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: token of "name" count
You can Wiki: getTokens() and then loop through the list of tokens (probably using a foreach_(roll_option)) checking each with Wiki: getGMName().silbrulf wrote: ↑Fri Jun 29, 2018 1:06 amHow do I set a macro to count how many tokens with a given "thing" (specifically a certain gm name) exist. Not majorly important, but I have a map that needs a set number of three types of token and counting them (they don't appear in a nice pleasing order) is a pain.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: token of "name" count
@wolph, actually... The thing I was wanting to look for was the "dm name". Either "queen" or "parliament". Then have a frame up that I can refresh for a running count of how many of each are placed. Specifics on the token are less important than having the numbers right.
@full bleed, I know I have used those before somewhere in the tutes... But I can't recall how they work. Ill check the wiki in a few and see...
@full bleed, I know I have used those before somewhere in the tutes... But I can't recall how they work. Ill check the wiki in a few and see...
Still learning macros, so anything in my code I could do in a simpler way would be appreciated.
Re: token of "name" count
im a bit behind in reading the posts, have you figured it out yet?
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS