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

Referencing character without selecting token

In order to facilitate exploration, we have all of our tokens controlled by the player and by all so that they share sight What I'd love to do is have a macro that I can call on at the start of combat that will remove the all from every player, and then at the end of combat put it back.  Using the character id, here's what I've got so far, but I'm getting a character not found error. !token-mod --set @{"-MM7Z-5IIqueY99uIQlY"|controlledby|+all}
1643587103
The Aaron
Roll20 Production Team
API Scripter
With that setup, it would look like this: !token-mod --set controlledby|+all --ids -MM7Z-5IIqueY99uIQlY I might suggest using the character's name though as that's easier to manage over time.  You could do all of the characters in one go like: !token-mod {{ --set controlledby|+all --ids @{someChar|character_id} @{someOtherChar|character_id} @{someYetOtherChar|character_id} }} You'd need two macros either way, one to add, and one to remove.  I'll look into the ability to toggle a player into and out of the controlledby field. One caution: there may be a bug with changing out the controlledby field with the API which could require your players to refresh.  If you run the above or similar macro and your players suddenly can't see anything, you may be running afoul of that issue.  It has been reported as fixed, but I've not had the chance to verify it.
Perfect, thank you!
1643639036
timmaugh
Forum Champion
API Scripter
You could have it work in a single macro, adding APILogic and Fetch to the mix: !token-mod{{   --set     controlledby|{&if '@(someChar.controlledby)' ~ all}+{&else}-{&end}all   --ids     @{someChar|character_id}     @{someOtherChar|character_id}     @{someYetOtherChar|character_id} }} That basically says "if the controlledby property of the character named someChar includes the word 'all', then put a + here, otherwise put a - here." And it is written assuming '-all' is the syntax to remove the "all" from the list. If I'm wrong about that syntax, I'll change it. Provided the someChar involved in the test is also always involved in the addition/removal of access, this would let you have a single macro that would toggle the controlledby state.