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

KH1 inside of a dropdown that references another dropdown.

So I'm working on sheets for my homebrew Dragonball system, which has stances you can shift to in combat. Problem is, the way the math plays out for the Aura penalty for being in the offensive/crane stance won't work properly and I've tried a handful of HTML replacements for the closing brackets and nothing works, it just won't roll. I'd like a bit of help sorting this hot mess out (especially since the Attack Macros will have a similar debuff for damage when in the defensive/turtle stance and I assume figuring this out will figure that out!). This is what the Defense Macro looks like at the moment; the defense and attack rolls are d6 pools, and any bonuses/penalties from the available powers/perks/feats in the system are added *after* the base pool and not factored in to stances. The whole thing works up until I try to make kh1 work within the dropdown; I've read the wiki, but I'm still scratching my head as to why things aren't working. &{template:default} {{name=Defense Check}}{{@{Character Name} tries to defend!}}{{Defense=[[(([[?{Stance?|    Neutral,(1*|   Crane,(floor(1.5*|    Turtle, (ceil(0.5*}?{Choose a Defense Type|    Barrier,@{Barrier}|    Block,@{Block}|    Counter,@{Counter}|    Deflect,@{Deflect}|    Dodge,@{Dodge}|    Endure,@{Endure}}))]])+[[?{Choose a Defense Type|    Barrier,[[0]]-[[0]]|    Block,[[0]]-[[0]]|    Counter,[[0]]-[[0]]|    Deflect,[[0]]-[[0]]|    Dodge,[[0]]-[[0]]|    Endure,[[0]]-[[0]]}]]+[[0]]+[[?{Defense Bonus|0} ]]-[[0]]-[[?{Defense Penalty|0}]])d6>5]]}}{{Aura=[[ (@{Aura}+[[0]]+[[ ?{Aura Bonus|0} ]]-[[0]]-?{Aura Penalty|0} ]]-[[?{Stance?| Neutral&#124,0&#125| Crane&#124,{[[(floor(@{Melee Attack}*1.25))-@{Melee Attack}]],[[(floor(@{Blast Attack}*1.25))-@{Blast Attack}]]}kh1&#125| Turtle&#124,0&#125}]])]]}} Cheers to anyone who's willing to lend a hand.
1698690245
timmaugh
Forum Champion
API Scripter
Of the "keep" mechanic syntax: {#,#}k1 Both the comma AND the closing bracket are control characters for a query, so first-level escaping would be: {#,#}k1 I know you said you tried several different variations of HTML substitution, but since I don't see this reflected in the example you gave, I figure I better mention it. Another thing to think about is whether the keep-syntax is in a nested query. If it is, there's a good likelihood that you'll have to escape it for both its OWN query, and any parent query above it. You can do this by escaping the ampersand character from your HTML replaced value... so a second-level escaping would look like: {#,#}k1 I haven't tested this, but it's worth a try to see if you can get this to work.
1698691182

Edited 1698691466
timmaugh said: Of the "keep" mechanic syntax: {#,#}k1 Both the comma AND the closing bracket are control characters for a query, so first-level escaping would be: {#,#}k1 I know you said you tried several different variations of HTML substitution, but since I don't see this reflected in the example you gave, I figure I better mention it. Another thing to think about is whether the keep-syntax is in a nested query. If it is, there's a good likelihood that you'll have to escape it for both its OWN query, and any parent query above it. You can do this by escaping the ampersand character from your HTML replaced value... so a second-level escaping would look like: {#,#}k1 I haven't tested this, but it's worth a try to see if you can get this to work. So am I writing out Comma and rbrace or am I supposed to just use , and }? Also, I tried both within the KH1 operation and it just doesn't roll. Does nesting go by number of queries or number of the same list of queries? Like, would I be doing | for the ending pipe for the kh1 line or would I be at something like | ? Is it because I'm drawing from attributes that themselves spec off of other attributes (i.e. Might Attack is listed as @{Might} + @{Strength} on the Attributes side of the sheet)? EDIT: I can get it to roll the Defense Pool, but it no longer reads out the Aura part of the macro ({{Aura= etc). So halfway there, but it's just straight up not acknowledging the second half of the macro. This is what I have now, by the way. &{template:default} {{name=Defense Check}}{{@{Character Name} tries to defend!}}{{Defense=[[(([[?{Stance?|    Neutral,(1*|   Crane,(floor(1.5*|    Turtle, (ceil(0.5*}?{Choose a Defense Type|    Barrier,@{Barrier}|    Block,@{Block}|    Counter,@{Counter}|    Deflect,@{Deflect}|    Dodge,@{Dodge}|    Endure,@{Endure}}))]])+[[?{Choose a Defense Type|    Barrier,[[0]]-[[0]]|    Block,[[0]]-[[0]]|    Counter,[[0]]-[[0]]|    Deflect,[[0]]-[[0]]|    Dodge,[[0]]-[[0]]|    Endure,[[0]]-[[0]]}]]+[[0]]+[[?{Defense Bonus|0} ]]-[[0]]-[[?{Defense Penalty|0}]])d6>5]]}}{{Aura = [[ (@{Aura}+[[0]]+[[?{Aura Bonus|0}]]-[[0]]-[[?{Aura Penalty|0}]]-[[?{Stance?| Neutral,0&#124 Crane,{[[floor(@{Melee Attack}*0.75)]],[[floor(@{Blast Attack}*0.75)]]}kh1| Turtle,0}]])]]}}
1698692522

Edited 1698693290
Edited - read next response below.
Jarren said: From a quick glance, there's a set of closing braces on the Endure line that are closing the Stance? query:    Endure,[[0]]-[[0]]}]]+[[0]]+[[?{Defense Bonus|0} ]]-[[0]]-[[?{Defense Penalty|0}]])d6>5]] }} {{Aura = [[ (@{Aura}+[[0]]+[[?{Aura Bonus|0}]]-[[0]]-[[?{Aura Penalty|0}]]-[[?{Stance?| Should be:    Endure,[[0]]-[[0]]}]]+[[0]]+[[?{Defense Bonus|0} ]]-[[0]]-[[?{Defense Penalty|0}]])d6>5]] } } {{Aura = [[ (@{Aura}+[[0]]+[[?{Aura Bonus|0}]]-[[0]]-[[?{Aura Penalty|0}]]-[[?{Stance?| There might still be something else as well. Changing that just breaks the macro entirely; it straight up won't roll with that text in place of the closing braces.
1698693272

Edited 1698693334
I started writing a response and realized that I misread your macro.  I thought the 'Stance?' query was closing early, but it looks like you're actually trying to reference the 'Stance?' query and ' Choose a Defense Type' query multiple times. So one issue that you'll definitely run into is that you can't use the same query multiple times with different outputs. One way to help organize queries in this way is by using a false API command before the actual macro, like this (this is not a working example!): ! ?{Stance?|Neutral,(1*|Crane,(floor(1.5*|Turtle,(ceil(0.5*}  ?{Choose a Defense Type|Barrier,@{Barrier}|Block,@{Block}|Counter,@{Counter}|Deflect,@{Deflect}|Dodge,@{Dodge}|Endure,@{Endure}} ?{Defense Bonus|0} ?{Defense Penalty|0} ?{Aura Bonus|0} ?{Aura Penalty|0} &{template:default} {{name=Defense Check}}{{@{Character Name} tries to defend!}}{{Defense=[[(([[?{Stance?}?{Choose a Defense Type}))]])+[[?{Choose a Defense Type}]]+[[0]]+[[?{Defense Bonus} ]]-[[0]]-[[?{Defense Penalty}]])d6>5]]}}{{Aura = [[ (@{Aura}+[[0]]+[[?{Aura Bonus}]]-[[0]]-[[?{Aura Penalty}]]-[[?{Stance?} That will help you separate out the queries from the body of the macro and see where it's breaking down.
1698693619

Edited 1698693771
Here's an example to illustrate what I was trying to explain above: ! ?{Number to Double|Two,2|Four,4|Six,6|Eight,8|Ten,10} ?{Number to Double} doubled = [[?{Number to Double} + ?{Number to Double}]] Each time the ' Number to Double' query is referenced after the first time, the same inputs and outputs are used. You cannot do this: ! ?{Number to Double|Two,2|Four,4|Six,6|Eight,8|Ten,10} ?{Number to Double|One,1|Three,3|Five,5|Seven,7|Nine,9} doubled = [[?{Number to Double} + ?{Number to Double}]] In the second example you'll only ever see the inputs and outputs for even numbers from the query. The result will be exactly the same as the first example, even though you changed the query items. In both cases, the first line starts with an exclamation point, which sends the chat command to the API server, and since there's no API command for ! 2 (if you selected 'Two' for the query) then nothing happens with it.
I feel the need to apologize to the helpful folk who showed up, because I just realized something; I keep track of all my R20 macros in google docs (I run a lot of my own homebrew these days). I could just make two separate versions and have each do the math separately and avoid this KH1 malarkey altogether!  That's 4 hours of my life down the drain, thanks for the help guys but I've found the simplest solution. However, now the problem has shifted to it refusing to work at all because - for some reason - it doesn't like the second dropdown. Would this be another case where I need to use HTML? &{template:default} {{name=Defense Check}}{{@{Character Name} tries to defend!}}{{Defense=[[(([[?{Stance?|    Neutral,(1*|    Crane, (ceil(0.5*|    Turtle,(floor(1.5*}?{Choose a Defense Type|    Barrier,@{Blast}+@{Endurance}+[[0]]-[[0]]|    Block,@{Agility}+@{Endurance}+[[0]]-[[0]]|    Counter,@{Might}+@{Athleticism}+[[0]]-[[0]]|    Deflect,@{Blast}+@{Detection}+[[0]]-[[0]]|    Dodge,@{Agility}+@{Athleticism}+[[0]]-[[0]]|    Endure,@{Might}+@{Endurance}+[[0]]-[[0]]}))]])+[[0]]+[[?{Defense Bonus|0} ]]-[[0]]-[[?{Defense Penalty|0}]])d6>5]]}}{{Aura=[[([[@{Toughness}]]+[[floor(@{Endurance}/2)]]+[[floor(@{Power Level}/4)]]+[[0]]+[[ ?{Aura Bonus|0} ]]-[[0]]-[[ ?{Aura Penalty|0} ]]-[[?{Stance?|    Neutral,0|    Crane,[[floor((@{Might}+@{Strength})*0.25)]]| Turtle,0}]])]]}}
Question: why are you using +[[0]]-[[0]] in the output for  each item in  your 'Choose a Defense Type' query?
1698694650
timmaugh
Forum Champion
API Scripter
Yes. Every instance of the control characters appearing within a query where they are not part of a character attribute/ability retrieval must be replaced: ,  => , |  => | } => } So you don't have to replace: @{Agility} But you do have to replace: ?{Defense Bonus|0} That would become: ?{Defense Bonus|0} So all of the control characters that would help you define your ?{Choose a Defense Type} query will have to be replaced (every comma, every pipe, and the closing brace)... as well as all of the little queries like ?{Defense Bonus|0}, as demonstrated just above.
Ok, try this: ! ?{Defense Stance?|Neutral,(1*|Crane,(ceil(0.5*|Turtle,(floor(1.5*} ?{Choose a Defense Type|Barrier,@{Blast}+@{Endurance}[Barrier]|Block,@{Agility}+@{Endurance}[Block]|Counter,@{Might}+@{Athleticism}[Counter]|Deflect,@{Blast}+@{Detection}[Deflect]|Dodge,@{Agility}+@{Athleticism}[Dodge]|Endure,@{Might}+@{Endurance}[Endure]} ?{Aura Stance?|Neutral,0|Crane,[[floor((@{Might}+@{Strength})*0.25)]]|Turtle,0} &{template:default} {{name=Defense Check}} {{@{character_name} tries to defend!}} {{Defense=[[ (?{Defense Stance?}*(?{Choose a Defense Type})) + ?{Defense Bonus|0}[Def. Bonus] - ?{Defense Penalty|0}[Def. Penalty])d6>5 ]]}} {{ Aura=[[ (@{Toughness}[Toughness] + floor(@{Endurance}/2)[Endurance] + floor(@{Power Level}/4)[Power Level] + ?{Aura Bonus|0}[Aura Bonus] - ?{Aura Penalty|0}[Aura Penalty] - ?{Aura Stance?}) ]]}}