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

Query Roll with a drop down menu that activate another drop down menu

Hi, I am pretty new at roll20 and I need some help, I was able to make a macros that allow me to select one option between AStats and BStats and if I select AStats, another list appear where I can choose between Acrobatic, Confuse, etc. The choices if I choose BStats are Counter, React, etc. Everything seems to work for the most part, but I have an annoying bug when selecting one of the choices of AStats. Here is my code :  /r 1d100 + ?{Stats| BStats, ?{Stats|AStats, ?{AStats}|Acrobatic,5|Confuse,1|Convince,1|Observate,6|Seduce/Taunt,1|Steal,-1|Threaten, 5|Autre,0}|Counter, 2|React,8|Seduce/Taunt, 2} As you can see in the image bellow, there is no problem when I select Bstats and then Counter, a 1d100 die is then rolled + 2 (which is the nomber for Counter), but when I select AStats and then Acrobatic, the result seem good because it does indeed roll a 1d100 + 5 for Acrobatic, but part of the code seems to show up in the chat, it doesn't seem to affect the result but it is annoying none the less... It's like that for all the options after selecting AStats and not the ones after BStats. I know my code isn't probably correct or optimal, but it's as far as I was able to code on my own. Can anyone know how to make it work or have any feedback that could help me? :) PS: I don't have access to any character sheets so I'm limited in what I can do.
?{Stats| BStats, ?{Stats|AStats, ?{AStats} You can't (easily) nest queries inside one another.  As soon as there is a vertical pipe | or closing brace } the first macro will assume it is part of that macro and join another option or close the query.  It can be possible with a lot of html substitutions to get the desired result, but that can run into other problems (html entities get parsed out of collection macros when they're reopened for example). You also don't typically want a space after any commas within queries, as they don't get removed. You also can't have queries that have the same name within the same macro.  In your example you use 'Stats' twice, with different options/results listed.  But if there is an identical query name, all of them after the first query will use the same options & results. You could create three macros: #WhichStats ?{A or B stats?|AStats,#AStats|BStats,#BStats} #AStats /r 1d100 + ?{AStats|Acrobatic,5|Confuse,1|Convince,1|Observate,6|Seduce/Taunt,1|Steal,-1|Threaten, 5|Autre,0} #BStats /r 1d100 + ?{BStats|Counter,2|React,8|Seduce/Taunt,2} You'd call the first macro '#WhichStats' which would then call AStats or BStats.  Or you could just use the macros for AStats and BStats if there's only two options. (Also you might need a backtick or html carriage return before #AStats and #BStats in the #WhichStats macro -- I'm typing this up from memory without actually checking it). Lastly you could circumvent the entire query macro problem by simply using a chat menu.
1620186131

Edited 1620187152
Thank you for the info, I did try to make a first macro that would then call AStats or BStats, but the first macro doesn't seems to want to call the other two. It will just write #AStats or #BStats in the chat and if I try to have a space between #AStats and the | so that it knows it's another macro, the code doesn't work anymore. I'm guessing that's why I would need a backtick or html carriage return before #AStats and #BStats? Then I would like to ask how would I use a backtick or html carriage in this situation?
Whoops you're not going to be able to call the #AStats or #BStats directly from the #WhichStats macro, because of the Roll20 Order of Operations . Each macro is fully expanded before the query is resolved. But you could create a macro that will put a button in chat that you can click on to run the #AStats or #BStats macro: [?{A or B stats?|AStats|BStats}](!
#?{A or B stats?}) FYI, you can post this into the #WhichStats macro, save it, and it'll work. But the moment you open  the macro again, the 
 and # will be parsed into their html characters (a carriage return and # respectively), and the macro will stop working until you copy it again. The other alternative is to replace all of the vertical pipes with | and closing braces with } in the #AStats and #BStats macros, which will have the same problem of being parsed if the macro is ever opened again. A better alternative is to use a chat menu. Why are your stats separated into 'A' and 'B'? Why not just have a query that lists them all? /r 1d100 + ?{Stat|Acrobatic,5|Confuse,1|Convince,1|Observate,6|Seduce/Taunt,1|Steal,-1|Threaten,5|Autre,0|Counter,2|React,8|Seduce/Taunt,2}
Thank you very much, in the end I went with the chat menu like you recommended, it ended up working better because I was able to regroup all my other stats lists in one place :) the reason they were separated in 'A' (Action stats) and 'B' (battle stats) is because of how the roleplay I in works and because I actually had more stats in other groups so if I put them all together it would of had made a huge list. Thank for the help it was very helpful! :D