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

How do I get nested dropdown queries to work?

1645826566

Edited 1645826796
For a little context I'm playing in a homebrew Naruto campaign where instead of potions of healing we use healing tags, these healing tags come in different sizes much like potions but they have the added the rule that you can use them either as an action or bonus action, and when used as an action they heal for the max amount instead of rolling the dice. I'm attempting to make a macro that asks both the type/size of the healing tag and if you're using it as an action or bonus action and no matter what I try I seem to end up with either 1 of 2 results, either all options appear in the first dropdown and when you get to the second one it just fills in the first of its options as a prefill and you can type something yourself, this does usually result in a result being displayed but it removes most if not all usability, or the second result is I get to separate the queries correctly by using the html entity codes, like explained here&nbsp; <a href="https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries" rel="nofollow">https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries</a> , but I can't get a numeric output to display from the queries in this case, this behavior seems consistent No matter if i try to do it all in the same macro or attempt to use separate macros. Any help would be highly appreciated, the 2 (or 3 depending on how you look at it) queries that I need to get to work together are as follows: ?{Action or Bonus Action|Action|Bonus Action} ?{Tag Type|Regular,[[18]]|Greater,[[36]]|Superior,[[54]]|Supreme,[[72]]} ?{Tag Type|Regular,[[3d6]]|Greater,[[6d6]]|Superior,[[9d6]]|Supreme,[[12d6]]} I have spent anywhere between 3 to 5 hours trying to solve this now, and all the googling and help I can find leads to queries that are 1 dropdown and one free fill in and don't seem to help me at all, I've tried both using the action/bonus action query as the base and using the tag type query as the base and building upon them in the same macro, I've attempted to set the action/bonus action macro as the base and calling a separate macro for selecting the tag type depending on if you've selected action or bonus action but neither worked and I think I've exhausted all possible avenues on my own by now. I'd rather attempt to do this with base macros feature because our DM is currently not very available out of game so if scripts are needed it is gonna take a while, but our DM does have a pro subscription and isn't against adding scripts either so please if your suggestion is "you can only do this with a script" elaborate on the needed script and an example of how it could work with said script to make everyone their lives a little easier.
1645830841

Edited 1645830944
This should give you the output you're looking for: !?{Tag Type|3|6|9|12} !?{Action or Bonus Action|Action,kh1|Bonus Action,kl1} [[{?{Tag Type}d6,{[[?{Tag Type}*6]]}}?{Action or Bonus Action}]] Or if you want it all on one line: [[{?{Tag Type|3|6|9|12}d6,{[[?{Tag Type}*6]]}}?{Action or Bonus Action|Action,kh1|Bonus Action,kl1}]]
1645834462
GiGs
Pro
Sheet Author
API Scripter
Jarren, thats a clever way to resolve this problem.
Jarren said: This should give you the output you're looking for: !?{Tag Type|3|6|9|12} !?{Action or Bonus Action|Action,kh1|Bonus Action,kl1} [[{?{Tag Type}d6,{[[?{Tag Type}*6]]}}?{Action or Bonus Action}]] Or if you want it all on one line: [[{?{Tag Type|3|6|9|12}d6,{[[?{Tag Type}*6]]}}?{Action or Bonus Action|Action,kh1|Bonus Action,kl1}]] Would that not suffer from the multiple api commands in chat/macros bug?
DM Eddie said: Would that not suffer from the multiple api commands in chat/macros bug? It shouldn't, because those are not real API commands -- they're not getting processed by any script.&nbsp; It's just using the API command button format to separate out the queries for two purposes: 1. It allows the queries to be processed in whichever order you want (so you could swap line 1 &amp; 2 and have the 'Action or Bonus Action' query process first) 2. It is easier to debug/modify the queries when they are on a line by themselves As far as the multiple API commands in chat bug, it's not something that I've encountered, but I also don't use very many macros that have multiple API commands.&nbsp; I'm guessing that they hang when one is still being processed while another is called or something, but I don't have nearly enough javascript understanding to venture much of a guess beyond that. I'd be curious to see an example of multiple API command button queries causing an issue. Maybe that's something to play around with and test without relying on an actual API script... that might help the devs track down the issue. If it did become an issue then the second version on a single line should resolve the problem.&nbsp;
Jarren said: This should give you the output you're looking for: !?{Tag Type|3|6|9|12} !?{Action or Bonus Action|Action,kh1|Bonus Action,kl1} [[{?{Tag Type}d6,{[[?{Tag Type}*6]]}}?{Action or Bonus Action}]] Or if you want it all on one line: [[{?{Tag Type|3|6|9|12}d6,{[[?{Tag Type}*6]]}}?{Action or Bonus Action|Action,kh1|Bonus Action,kl1}]] There are no issues with the first version using multiple nonexistent API commands, or issues with it at all its actually working great and exactly what I needed so thank you very much, I would love an explanation on how kh1/kl1 decides whether to use the Xd6 or X*6, so I could potentially use it in the future if I understand it
I’ll use a single Tag Type as an example: the Regular 3d6 version: There are two numbers being compared: the 3d6 or 3*6, and those are first each wrapped in double brackets [[ ]] to make them a number, then put between braces to compare them. (Hopefully that’s clear enough but go ahead and ask if not.) Lastly the kh1 and kl1 are comparison tools to either ‘keep the highest single roll’ or ‘keep the single lowest roll’. If using an action, then you keep the highest of the two numbers (which is always going to be 3*6); and if using a bonus action you keep the lowest of the two numbers (which is always the 3d6).&nbsp; You can read more about it all on the&nbsp; Dice Reference Wiki .&nbsp;
Jarren said: I’ll use a single Tag Type as an example: the Regular 3d6 version: There are two numbers being compared: the 3d6 or 3*6, and those are first each wrapped in double brackets [[ ]] to make them a number, then put between braces to compare them. (Hopefully that’s clear enough but go ahead and ask if not.) Lastly the kh1 and kl1 are comparison tools to either ‘keep the highest single roll’ or ‘keep the single lowest roll’. If using an action, then you keep the highest of the two numbers (which is always going to be 3*6); and if using a bonus action you keep the lowest of the two numbers (which is always the 3d6).&nbsp; You can read more about it all on the&nbsp; Dice Reference Wiki .&nbsp; Apologies for the late reply, I went on to try out more stuff and experiment with it and it works wonderfully! Thank you so much again! I do have one more question this is more to satisfy my general curiosity and see the limits of the system, this particular way work because were dealing with a binary solution where the result is always either max or below max, but in case we were dealing with 2 or more queries that depend on each other that all had 3+ options, would there be a way to actually make that work?
Kilidian said: I do have one more question this is more to satisfy my general curiosity and see the limits of the system, this particular way work because were dealing with a binary solution where the result is always either max or below max, but in case we were dealing with 2 or more queries that depend on each other that all had 3+ options, would there be a way to actually make that work? If I understand your question correctly, you are talking about a situation that has a series of ranges, such as: a d20 roll, with 5 or below is one result, 6-10 is another, 11-16 is a third, and 17-20 is the last?&nbsp; Then each result could have a subset of possible queries from there? (Just as an example) In that case the built-in Roll20 Dice Roller will not handle a macro at all, or if it does it is incredibly tricky to set up and uses some perhaps not intended 'features' of the dice roller mechanic, or a very complex setup.&nbsp;&nbsp; If you give an example of what you're thinking then someone might be able to give you a clearer answer as to whether it's possible or the reason why it wouldn't be possible.