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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Dropdown Queries - Using A Single DDQ To Output Multiple Values

The Problem I Face:  I love using dropdown queries to automatically display relevant information about spells I cast at various levels/ranks.  Since I play Pathfinder 2e, the heightened versions of spells don't always follow easy patterns that I can stuff into a single query, thus necessitating two.  Take for instance the spell Safe Passage, which can be cast at 3rd, 5th, and 8th ranks.  The 3rd-rank version creates a 60ft long tunnel with resistances of 5, the 5th-rank version creates a 120ft long tunnel with resistances of 10, and the 8th-rank version creates...a 500ft long tunnel with resistances of 15.  This requires an entire polynomial to achieve different results for the length of the tunnel, which will be predictably messy to calculate, and trying to do it the other way around is even more frustrating.  Wouldn't it be nice if you could just add more output values into your dropdown queries? Some Solutions:  I can think of a couple ways to solve this issue, each with their own merits and drawbacks.  If you have another solution yourself, please feel free to let me know. RC1/"The Index Method":  When writing the first call of a dropdown query, include more than one set of outputs for each label.  You can use this every time you call the dropdown query again in the same script with an index number to point to which set of outputs to use, even on the first call. Current Working Syntax: ?{Query:i|L1,L1v1,L1v2|L2,L2v1,L2v2|...} # i is the index number; if not specified, defaults to 1 (the first output value) # i may be 0, which will attempt to use the label as the output Example: [[?{Level?:1|1,2,6|2,3,6|3,4,7|4,5,7}d4]] Fire Damage # First use sets the labels 1, 2, 3, and 4 as the options to present to # the user, uses the first output as defined by the code [[?{Level?:2|1|2|4|5|5,8}]] Persistent Fire Damage # Second use calls for the second value of the chosen option to be used; # any attempts to make new labels or set new values are discarded as per usual [[?{Level?:0}]] HP Healed On Caster # Third use takes advantage of the labels' numberiness # and outputs the labels themselves [[?{Cookie?:4|Yes,1,0,1,1|No,0,0,0,0}]] # First use of the "Cookie?" query sets values for the options for # "Cookie?", and references the fourth value in each option Pros:   Later calls with different output values are much shorter, as seen in Line 3 of the Example. Will not conflict with current uses in R20 making use of both the labels and a single value each, as the default index number is 1 and later definitions are ignored entirely. Only requires a slight bit of extra code to cover the cases where the labels themselves are the only output values, code which may already be written. Cons:   The first dropdown query can become quite large depending on how many index numbers are required, as shown with only 4 options and 2 output values for each on Line 1 of the Example. You can't add a new output value in later calls. Memory may be an issue if things get large enough; I wouldn't recommend stuffing your entire spellbook into two queries. Calling with 0 as the index may result in trying to feed an incompatible data type to the surrounding code; should throw an exception as usual. RC2/"The Redefine Method":  The dropdown query starts off much the same as any other dropdown query, but later calls can redefine the value outputted at the time of call. Current Working Syntax: ?{Query|L1,L1v1|L2,L2v1|L3,L3v1|...} # As usual, the first call defines the dropdown query ?{Query|L1v2|L2v2|!|...} # New values are put into the same places as the original # call; These either redefine values for both this and later # calls, or simply redefine for just this call # "!"s are used for when the new value is the same as the old Example:  [[?{Level?|1,2|2,3|3,4|4,5}d4]] Cold Damage # First call sets the options as 1, 2, 3, and 4, with the # values 2, 3, 4, and 5 respectively [[?{Level?|!|4|6|8|5,10}]] Persistent Cold Damage # Second call changes the values of labels 2, 3, and 4 # to 4, 6, and 8; leaving the value for label 1 as 2 # The 10 is not associated with any current options and # is discarded; Similarly, any labels are discarded [[?{Level?}]] HP Healed On Caster # What happens here is dependent on how this is implemented # Please refer to the commentary in Current Working Syntax, Lines 2-4 Pros:  Dropdown query calls are of reasonable length whether it's the first or not. Memory isn't much of a problem. Cons:  Messy uses currently written may break or cause extra load rewriting redundant values, necessitating the user to rewrite their code in the former and potentially extra code to avoid redundant rewriting of values in the latter. I can add additional revision candidates as time goes on and they are suggested.  Yes, I am aware that these two methods aren't mutually exclusive and could be combined together for "THE ULTIMATE DROPDOWN QUERY!" , but that's probably a bad idea, so I didn't bother writing it down.
Interesting suggestion, but any changes to the syntax should be made with care to not break the mountains of existing macros. Anyway, your initial problem can be resolved relatively easily with current syntax: [[?{spell rank|3,1|5,2|8,3}*5]] resistances, [[{60,60,380}kl?{spell rank}]] long
Tuo said: Interesting suggestion, but any changes to the syntax should be made with care to not break the mountains of existing macros. Anyway, your initial problem can be resolved relatively easily with current syntax: [[?{spell rank|3,1|5,2|8,3}*5]] resistances, [[{60,60,380}kl?{spell rank}]] long Yes, any syntax shown in my post is a mere placeholder.  It's only used to illustrate what the final idea might look like.  This is a con for RC1, which requires the use of an extra symbol in the syntax, and a pro for RC2, which requires only an extension on the already built syntax.  Thanks for the suggestion on a resolution to my example problem, as that fixes a current issue I have already, though things will not necessarily always work out that way for all use-cases (what if the length numbers were 60, 100, and 500, for example).  A general solution is still preferred.
ShylokVakarian said: Tuo said: Interesting suggestion, but any changes to the syntax should be made with care to not break the mountains of existing macros. Anyway, your initial problem can be resolved relatively easily with current syntax: [[?{spell rank|3,1|5,2|8,3}*5]] resistances, [[{60,60,380}kl?{spell rank}]] long Yes, any syntax shown in my post is a mere placeholder.  It's only used to illustrate what the final idea might look like.  This is a con for RC1, which requires the use of an extra symbol in the syntax, and a pro for RC2, which requires only an extension on the already built syntax.  Thanks for the suggestion on a resolution to my example problem, as that fixes a current issue I have already, though things will not necessarily always work out that way for all use-cases (what if the length numbers were 60, 100, and 500, for example).  A general solution is still preferred. The problems with the second approach are that it would make ! a potential problem character where it already serves as a special command character - I don't imagine it shows up often in queries alone, but it could happen. And secondly, it would prevent overwriting one set of query options with another, which is a niche technique, but situationally useful. Also, 60, 100, 500 would work as  [[50+{10,40,400}kl?{spell rank|3,1|5,2|8,3}]] Technically any set of increments is possible, though some might require different and more complex techniques. 
Tuo said: ShylokVakarian said: Tuo said: Interesting suggestion, but any changes to the syntax should be made with care to not break the mountains of existing macros. Anyway, your initial problem can be resolved relatively easily with current syntax: [[?{spell rank|3,1|5,2|8,3}*5]] resistances, [[{60,60,380}kl?{spell rank}]] long Yes, any syntax shown in my post is a mere placeholder.  It's only used to illustrate what the final idea might look like.  This is a con for RC1, which requires the use of an extra symbol in the syntax, and a pro for RC2, which requires only an extension on the already built syntax.  Thanks for the suggestion on a resolution to my example problem, as that fixes a current issue I have already, though things will not necessarily always work out that way for all use-cases (what if the length numbers were 60, 100, and 500, for example).  A general solution is still preferred. The problems with the second approach are that it would make ! a potential problem character where it already serves as a special command character - I don't imagine it shows up often in queries alone, but it could happen. And secondly, it would prevent overwriting one set of query options with another, which is a niche technique, but situationally useful. Also, 60, 100, 500 would work as  [[50+{10,40,400}kl?{spell rank|3,1|5,2|8,3}]] Technically any set of increments is possible, though some might require different and more complex techniques.  Thanks for opening my eyes further to how I might go about doing these without the general solution I'm requesting, these really help me.  As for the syntax thing for RC2, I am very unaware of what characters are and aren't in use that may cause issues with other commands.  Do you have any suggestions for what to use instead of an "!"?  And is the ":" that is used in RC1 okay, or would I need a new character for that as well?  I genuinely want to do everything I can to get this idea past that +10 mark and hopefully get this in eventually (I know a lot of things in this sub still haven't been added, and I imagine mine will be no exception to that rule).  Also, your vote would really help towards that, if you have any to spare.
1746080590
Roll20 Dev Team
Pro
Marketplace Creator
Thanks for the suggestion! After 30 days, Suggestions and Ideas with fewer than 10 votes are closed and the votes are refunded to promote freshness. Your suggestion didn't build the right momentum this time, but feel free to submit it again! We find that the best suggestions describe the problem you are having, and the solution you want. You can learn more about the process of making suggestions on the Roll20 Wiki! More details can be found here .