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

Triggering API commands without having to select tokens?

I seem to be having trouble with getting the It's A Trap! to trigger any API command. However, it could be because the things I'm trying to do normally require me to have the token selected first. I'm having a difficult time knowing where to even substitute the trap_id and victim_id for these commands. It may not be possible. I'm not sure. I.E. !ct add prone (CombatTracker script). Normally I must have the token selected to perform that macro but I would like to automate the process by having the trap add it automatically. The specific example I'm working on is having it add the prone condition to someone who has fallen into a pit trap. As well as adding the restrained condition to those who step onto bear traps. Or, !cm -vs (View Shop with the Cash Master script.) I have a trap on the gm layer that is set to GM only and the message simply pops up with the name and type of shop when it is spotted. I'm using the search and blast distance as the entirety of the shop size on the map and I was trying to trigger that macro whenever my players walked into a shop and triggered the trap. This may be big dreaming here. But it would be cool.  Am I running into problems because I'm just not formatting the commands properly? Or is there even a way to perform those kinds of commands without selecting the token? 
1562280588
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It very much depends on the script. Many of the more powerful scripts (such as token mod, ChatsetAttr) will allow you to specify the target by ID. If that functionality is not in the script, it does what it does.