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

msg.selected and @{target|token_id}; part trois

If you put an `@{target|*}` in a command line it will deselect any selected token.  This I've read and verified and tested in various perturbations :/.  What I have not been able to discern or discover is how to work around this problem in the simple case that I am interested in. I have an API action let's call `!takeAction` in a script listening on `chat:message`.  So far so good.  This action is intended to be put into a token action, so it will show up in a button when the token is selected. What I would *like* to do, is set it up so that when the button is pressed, the script runs with awareness of both what token was selected, and bring up a target "dialog" for selecting one or more targets (I'd settle for one target at the moment) which the executing script could likewise identify and interrogate.  The question is how to do this?  I know it must be possible because `!power` cards can do it (but the code is rather dense (or I am ;)). I *do* understand the idea that I could use a two part system where my original action might emit into chat a button you can push which would have annotated the id of the token you had selected and trigger a target that way, but it is both desirable and seemingly doable to achieve this functionality without requiring a two button press usage case.  It seems like such an obvious, basic scenario that many people must have solved this already.  I just haven't found any such solution posted (at least that I recognized ;).  
1542242993

Edited 1542243064
GiGs
Pro
Sheet Author
API Scripter
I normally have the script call include both @{selected|character_id} and @{target|character_id} eg something like: !takeAction --caller|@{selected|character_id} --target|@{target|character_id} I think this captures the character who was selected at the start of the macro, and the target you select. Does that not work?
I would have sworn I tried that and it didn't work, but it appears to be working now, so...  Great!  Thanks a lot!