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

Nested query with API

Hello folks, once again I ask a question I have not found an answer to:             const open      = "&#"+"123;"             const close     = "&#"+"125;"             const comma     = "&#"+"44;"             const question  = "&#"+"63;"             const pipe      = "&#"+"124;";             const query = `?{Name of Query| Select:, ${question}${open} Choose: ${pipe} Option1 ${comma} 1 ${pipe} Option2 ${comma} 2 ${close} }`;                          sendChat(msg.who, '[Test](!something ' + query + ')' ); I want to create a button or more precisely a query with nesting. I expected this to give me only one option 'Select' and after that offer me two options 'Option1' and 'Option2'. Instead I get all three options. I tried to double escape the entities but that just resulted in a broken query. So, how do I have to format this so that I get 2 consecutive queries ?
1517363536

Edited 1517363968
Silvyre
Forum Champion
Try adding a second option after ${close}, i.e. `?{Name of Query| Select:, ${question}${open} Choose: ${pipe} Option1 ${comma} 1 ${pipe} Option2 ${comma} 2 ${close} | Placeholder }`; The second option is necessary in order to get the the "Name of Query" Roll Query to function as a dropdown Roll Query. Also, be prepared that nesting your Roll Query within an API Command Button is going to add a layer of complexity (i.e. nesting and complications ) to your endeavors, which you'll have to account for. I'd recommend having your script output to a Handout until it works well enough to factor in API Command Buttons.
1517388742

Edited 1517388865
I just tried what you proposed and it simple does not work. The placeholder isn't even shown. So I'm exactly where I was before. Outputting to  a handout does not do what I want because this is used in a HTML turnOrder that I write to chat. There I use command buttons to modify the state of the members of the turnorder.