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

[Help] Have the API display a custom query for the person who launched a command

1449766999
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
Is there a way to have something go directly from the API to a query? What I would like to do is have a token action,that when somebody pressed it, would give a custom dropdown menu.  Lets assume that there are three optional settings, and that when the user happens to press it, the token that he has selected has options one and two turned off, and option 3 turned on. I would like to have a query box open that gives three dropdown options, Turn option 1 on, Turn option 2 on, turn option 3 off. If the user had a different token selected, then menu would be different depending on which options that token had turned on.  Now I know that I could have a button that would create a custom button and send that button to the chat log, and the user could then press that button. And that 2nd button would give the customized menu. But is it possible to just have one button that does it all in one operation instead of two? Thanks.
Impossible to trigger any roll queries using the API. To do what you want to do, you'd have to make a character sheet for each token and put the macros on them.
?{Options| Turn Option 1 @{selected|option1}, !script to toggle @{selected|option1} Turn Option 2 @{selected|option2}, !script to toggle @{selected|option2} Turn Option 3 @{selected|option3}, !script to toggle @{selected|option3} } Something like that?
1449788173
The Aaron
Pro
API Scripter
Depending on what you mean by the token having options turned on and off, there might be a few ways to do this: 1) If you mean in the character sheet the token is attached to that you will be checking on/off several things, you could use Sheet Workers to build the Roll Query in a hidden attribute which would be used for the body of the macro. (pretty sure...) 2) If you mean toggling on something like particular status markers, you could have the API build the Roll Query in one of the Token's Bars (or even it's name if you're not displaying that) and then have the macro access @{selected|bar1} to get the Roll Query. (probably...)
1449827872

Edited 1449827925
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
The Aaron said: 2) If you mean toggling on something like particular status markers, you could have the API build the Roll Query in one of the Token's Bars (or even it's name if you're not displaying that) and then have the macro access @{selected|bar1} to get the Roll Query. (probably...) OK - Yes. I think this might work.&nbsp; Yes I am using statusmarkers.&nbsp; So what you are saying is that every time I change a statusmarker - I should recreate a new menu and store it with the token. So for example if "bolt-shield" (defensive stance) and "back-ache" (knocked down) are displayed - the menu might look like Choose an Option: Turn Aggressive Attack On Turn Defensive Stance Off Turn Knocked Down Off Turn (etc) On And my token macro can access this menu and run it. I will give that a try. Thanks! Now for the harder part. Is it possible to make a selection option contain an icon? What I would really like is for each option in the select statement to be of a form&nbsp; (bolt-shield) Turn Defensive Stance Off where (bolt-shield) as actually displaying the icon&nbsp; <a href="http://game-icons.net/icons/lorc/originals/png/bold-shield.png" rel="nofollow">http://game-icons.net/icons/lorc/originals/png/bold-shield.png</a> I have been experimenting, and so far can't get this to even come close to working.&nbsp;
1449835616
The Aaron
Pro
API Scripter
There isn't a way to do that from the API.&nbsp;