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

Variable field list in templates and nesting dropdown queries

I have a template that is used for weapon rolls. Weapons can be used in a few different ways, and each way requires a subset of fields. Most of these fields have dropdown queries, and all needs to be rolled every time, even if they are not needed. When parrying, hitLocation is irrelevant, as well as damage, etc. I've spent the day reading about nesting dropdown queries and how that can be used to set a subset of the templates fields. I think I'm doing it correctly, but it does not work. Mostly I only get one dropdown option, that then gets a long string as a value. I've read the wiki on advanced uses of dropdowns, I've read MarkofTheDragon's post  countless times, several threads where Scott C, Sylvire and GiGs discuss topics related to this. I'm at a loss, please help me. I've tried both approaches, ofcourse following the rules of not altering things belonging to attributes and keeping the outer query "as is". &{template:MyTemplate} ?{Test|Test1,{{Field1=Bla}}{{Field2=Bla2}}|Test2,{{Field3=Bla3}}{{Field4=Bla4}}} &{template:MyTemplate} {{?{Test|Test1,Field1=Bla}}{{Field2=Bla2|Test2,Field3=Bla3}}{{Field4=Bla4} }} To practice I started doing nested dropdown queries, but I cant even get those working. Same issues. To few or to many options, with both the label and its "value". I do them like this: type=? { Type |Attack,? { Where |Standard, standard |StandardRanged, standardRanged } |Aim, ? { Where |Head, head |Arm, arm } } Which is then changed to this: type=? { Type |Attack, ? { Where |Standard, standard |StandardRanged, standardRanged } |Aim, ? { Where |Head, head |Arm, arm } } Since it is only one extra level, to my understanding the "&" should not be replaced with "&amp" yet. I then combine into one row and uses that for the fields for the template. "&{template:MyTemplate} {{type=?{Type|Attack, ?{Where|Standard, standard|StandardRanged, standardRanged}Aim, ?{Where|Head, head|Arm, Arm}} }}" This nested dropdown Attack, standard and standardRange as values, but i expected Attack and Aim. There are issues with what values gets assigned aswell. some values are long and include "|" in them. In short, I wanted to use queries to filter what fields needs to be assigned values for the template in order to cut down on unnessicary dropdowns. They require html character replacement, so I figure I'd paractice with nested queries but can't get anything to work propperly. Have things changed from a few years ago where it was obvious and straight forward how to do this, or am I doing something wrong? Is there someother way to go about having different subsets of template fields calculated?
1577587020
GiGs
Pro
Sheet Author
API Scripter
Necris said: Have things changed from a few years ago where it was obvious and straight forward how to do this, or am I doing something wrong? Is there someother way to go about having different subsets of template fields calculated? This made me chuckle, because it's never been obvious or straightforward. One thing I'd suggest is forget about using the rolltemplate when testing. Concentrate on just the query (and its nested queries), and discard everything else. Once you have the query working, then you can put it in a template for its final form. When I copy out just the query above, i get ?{Type|Attack, ?{Where|Standard, standard|StandardRanged, standardRanged}|Aim, ?{Where|Head, head|Arm, arm}} and this works. Then i add the template construction around it, and get &{template:default}{{name=test}}{{type=?{Type|Attack, ?{Where|Standard, standard|StandardRanged, standardRanged}|Aim, ?{Where|Head, head|Arm, arm}}}} And this works. You could above does fail, so i copied out the query itself, and that still failed. Here's your query, compared to mine: ?{Type|Attack, ?{Where|Standard, standard|StandardRanged, standardRanged}Aim, ?{Where|Head, head|Arm, Arm}} Aha, comparing them it's missing the required | before Aim.
1577624596

Edited 1577635435
GiGs  said: Necris  said: Have things changed from a few years ago where it was  obvious and straight forward  how to do this, or am I doing something wrong? Is there someother way to go about having different subsets of template fields calculated? This made me chuckle, because it's never been obvious or straightforward. One thing I'd suggest is forget about using the rolltemplate when testing. Concentrate on just the query (and its nested queries), and discard everything else. Once you have the query working, then you can put it in a template for its final form. When I copy out just the query above, i get ?{Type|Attack, ?{Where|Standard, standard|StandardRanged, standardRanged}|Aim, ?{Where|Head, head|Arm, arm}} and this works. Then i add the template construction around it, and get &{template:default}{{name=test}}{{type=?{Type|Attack, ?{Where|Standard, standard|StandardRanged, standardRanged}|Aim, ?{Where|Head, head|Arm, arm}}}} And this works. You could above does fail, so i copied out the query itself, and that still failed. Here's your query, compared to mine: ?{Type|Attack, ?{Where|Standard, standard|StandardRanged, standardRanged}Aim, ?{Where|Head, head|Arm, Arm}} Aha, comparing them it's missing the required | before Aim. Thanks for the pointers, anything to make it easier. I actually made several changes to the code sections after I copied them here to get rid of swedish words. In that process the "|" was lost. I do have it in my code here. I'm using your first line and skipping the template, but I still don't think that it is working, is this how it should work: My button: <button     type="roll"     name="roll_vapen"     value="?{Type|Attack, ?{Where|Standard, standard|StandardRanged, standardRanged}|Aim, ?{Where|Head, head|Arm, arm}}"     class="sheet-tabellTarning" ></button> 1: First popup has the first queries first value and both of its nested query's values. 1.1: Selecting Attack gives me the first queries second option and its nested query's both values: The outputs of these three when selecting them are: 1. Attack     1.1: Aim -    ?{Where     1.2: Head -    head}      1.3: Arm -    arm} 2. Selecting Standard from the first dropdown I get the second query's both labels: The outputs of these two when selecting them are: 2. Standard     2.1 Head -    standard|Aim, head}     2.2 Arm -    standard|Aim, arm} 3: Selecting standardRange from the first popup I again get both labels from the second query, but the outputs change to: 3. StandardRanged     3.1 Head -    standardRanged|Aim, head}     3.2 Arm -    standardRanged|Aim, arm} Is this how they should work? It's weird that I don't see all labels from the first query in the first dropdown, and it's weird that selecting something going down one path, I still need to select something in the other path. This is exactly how it worked yeasterday, I just assumed that this was wrong and it should behave differently.
Posting a followup to this as this might affect more than me. I've now spent another handfull of hours on this issue and I think I have some clue as to what is going on. Here is how the relevant section of the sheet looks like. In the TEST section I have written the information into the fields manually, and here it works. I get different fields depending on which dropdown I select in the roll: In the "TEST2" section the fields get their data from the fields "value". In the code it looks like this: < td >     < input      type = "text"      name = "attr_vapenRollAttack"      value = "{{typ=Attack}} {{skada=10}} {{slag=[[10"      class = "sheet-fardighetstabell"     /> </ td > < td >     < input          type = "text"          name = "attr_vapenRollSikta"          value = "{{typ=Sikta}} {{skada=10}} {{var=huvudet}} {{slag=[[15"          class = "sheet-fardighetstabell"     /> </ td > < td >     < input          type = "text"          name = "attr_vapenRollParrera"          value = "{{typ=Parrera}} {{slag=[[20"          class = "sheet-fardighetstabell"     /> </ td > But as you see in the picture the html replacements are back to "}". The dropdown anly has the first value and it looks like this: If I manually alter the fields and revert all the in the fields "}" to } everything works, and the different dropdowns assign values to different subsets of fields or different values to the same field:   This means that I know that the information in the fields is enough to make it work. If i then substitute the "attribute calls" that the roll previously used to get the info from the fields with the information in the fields themselfs, I get this query: < td >     < button          type = "roll"          name = "roll_vapenMain"          value = "&{template:dropdownTest} {{name=@{vapenNamn}}} ?{Handling|Attack, {{typ=Attack}} {{skada=10}} {{slag=10|Sikta, {{typ=Sikta}} {{skada=10}} {{var=huvudet}} {{slag=15|Parrera, {{typ=Parrera}} {{slag=20}}}"          class = "sheet-tarningstabell"     ></ button > </ td > This fails and gives me the same result as when the fields had "}" in them instead of the "& #125;" replacement characters: TLDR: I know that the query works, since when I split it out and use the info I manually put into fields it works. I also know that inputfields that gets assigned their strings backend to their "value=" gets their replacement characters replaced with "}" etc. when showed frontend. Making a propper nested roll query fails the same way as when using "}" in the fields I could enter the subqueries manually. Is this how it behaves for others aswell or there something perculliar with my browser?