Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
Create a free account

Grouping Tokens using API

Is there a property for tokens (akin to say 'isdrawing' or 'controlledby') that allows for the grouping of tokens? I know you can group tokens on the screen by selecting them and then right click -> advanced -> group, but is there an API accessible Object property that does this? Thanks
<a href="" rel="nofollow"></a> It doesn't look like it, no.
API Scripter
I don't think that feature is exposed to the API for setting. What are you trying to do? I ask because you can dynamically (if only virtually) select tokens via criteria statements using SelectManager so that those tokens are what other scripts would see as the selected tokens for a given message. For instance, you can select tokens that are named as being a part of "Squad02" (that is, they have that as part of their name) by this: {&amp;select *Squad02*} Or maybe you've given a particular status marker called "Mob" to various tokens, with the value (0-9) noting which mob they belong to. You can select the tokens of Mob 3 with something like: {&amp;select *, Mob=3} Or maybe you have NPCs and you want to stash their group affiliation in a bar. Maybe bar2 contains the name of their group. You could select the group you've named "VillageEncounter1" like this: {&amp;select *, bar2=VillageEncounter1} Of course, things can expand and you can only select the VillageEncounter1 group who has a bar3 value (where you've stored their HP) above 0: {&amp;select *, bar2=VillageEncounter1, bar3&gt;0} Setting these groups up would be straightforward... selecting them, then running some form of TokenMod or ChatSetAttr command (depending on where you wanted to store their affiliation) possibly with a SelectManager forselected handle to give tokens individual results (if that was necessary). Now that your affiliation is stored, you can always recall that group later using a call similar to those above.
Working on a script for a tabletop war game system - basically want to put pinned or bailed out tokens on the tokens representing miniatures on the board (tanks, infantry squads etc), rather than using Status Markers or auras. I wondered if that functionality to group was exposed but given that it isn’t, I’ll code it into the api - so when the unit is pinned, I’ll place the pinned marker and then have it ‘follow’ the unit around when the unit/team is moved, and remove it when the unit rallies.&nbsp;