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 with OnMyTurn Script

1652457902
Nick O.
Forum Champion
I'm trying to use the OnMyTurn script from this post -&nbsp; <a href="https://app.roll20.net/forum/post/6608405/script-onmyturn-activate-an-ability-in-the-context-of-a-token-when-its-turn-occurs/" rel="nofollow">https://app.roll20.net/forum/post/6608405/script-onmyturn-activate-an-ability-in-the-context-of-a-token-when-its-turn-occurs/</a> I've got it working with simple die rolls, but when I try to include a query, I receive an error.&nbsp; Here's the command that I've placed in the OnMyTurn ability&nbsp;&nbsp;&amp;{template:default}{{name=Generate Ferocity}}{{Ferocity Generated=[[?{How many adjacent enemies}+1d4]]}} Here is the error that appears in the API console: "OnMyTurn: ERROR PARSING: &amp;{template:default}{{name=Generate Ferocity}}{{Ferocity Generated=[[?{How many adjacent enemies}+1d4]]}}" "OnMyTurn: ERROR: SyntaxError: Expected \"(\", \".\", \"[\", \"abs(\", \"ceil(\", \"d\", \"floor(\", \"round(\", \"t\", \"{\", [ |\\t], [+|\\-] or [0-9] but \"?\" found." It looks like it doesn't like the question mark from query, is there a way to get it to accept that?&nbsp; Thanks in advance!
1652460466
timmaugh
Pro
API Scripter
Queries can't be used in API-generated messages, and that is ultimately the API sending the command. The problem is that the question would be posed to the sender of the message, the API can't answer the question. You can try hiding the query in a button that the OnMyTurn script would send to the chat... letting you click to start the *actual* event you want to trigger, but meanwhile becoming the author/sender of the request.&nbsp; &nbsp;
1652467534
Nick O.
Forum Champion
Thanks, timmaugh!