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

Select a specific named token with a macro or script.

This is either really simple or really complex. I want to use the improved SUMMON script updated by @The Aaron, but I want the token that is summoned to be selected when the token is laid down on the tabletop. Right now the SUMMON script works by selecting a token already on the tabletop and "summons" another token by name in a space next to it.  The Token summoned on the tabletop is not the selected token. I want to move the selected token to the newly laid down token. This will allow to make other modifications in one Macro using the @selected.  Thoughts ?  1. Click a spell caster or enemy token.  2. Summon a Token called "Spell"   3. Use Change Token Image script to select a spell area of effect Image from the rollable table. 
1565822219
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I don't think the API can select an object. However, I believe that you can likely affect a token identified by its name, or associated character using token-mod. So maybe you can summon it and the macro + script could perform transformations. The Aaron would know better.
I generally build my maps with "wings", small areas not used by the map and corralled with dynamic lighting. Like in a theater, i store monsters and NPCs that will or may be needed for the scene. It is faster than using the GM layer, and could offer an easy work around for you.
1565822685
Ziechael
Forum Champion
Sheet Author
API Scripter
I used the summon script to create spell templates when specific spells were cast (heavily power card automated game), I just made sure to set up a token action on the template themselves that ran a tokenmod macro to change the face, set the size and assign control to the caster. Meant that spells with area effects could be managed with a single click and a few queries and then handed over to the caster to place... will dig out some examples when I'm not falling asleep lol
1565826495

Edited 1565826839
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Here's what I use . If you can identify the token by name (not sure if Token-mod does that), you could summon the token and run the transformation without selection. Video . Just checked, I think Token mod will specify by id using this syntax: !token-mod --ignore-selected --set currentside| SIDE --ids @{ Character Name |character_id} !token-mod --ignore-selected --set width|[[70* N ]] height|[[70* N ]] --ids @{ Character Name |character_id}) Side  = Side of rollable token as integer. N  = Number of units for size of token effect. Character Name = the name of a character uniquely used for spell effect tokens.