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

Nesting Query Inside Query

September 28 (6 years ago)

I am having trouble trying to figure out what I'm doing wrong. I have looked over the Advanced Macro Usage guide for how to code this, but still it isn't doing what I'm wanting it to do. I'm wanting the macro to be able to have a player choose between Option A (Standard Attack), Option B (Attack with Benefit), or Option C (Attack with Hinderance) and then, once they select that option be able to enter a +/- value that modifies that roll. For example: A player chooses that they are making an attack with Benefit, they choose that option and then they also have a +2 bonus on the roll; after selecting the Benefit from the drop-down the next pop-up asks for what the modifier should be and they add +2, causing it roll 3d10kh2+@{selected|charattackvalue}+2. Can someone please help me fix this macro? Here's what I have so far (and isn't working as intended)


&{template:default} {{name=Basic Attack}} {{attack=[[

?{Attack Type|

Standard, 2d10+@{selected|charattackvalue} |

Modifier 1A, ?{Modifier|?} |

                } |

Benefit, 3d10kh2+@{selected|charattackvalue} |

                Modifier 2A, ?{Modifier|?} |

| |

Hinderance, 3d10kl2+@{selected|charattackvalue} |

                Modifier 3A, ?{Modifier|?} |

} ]]}}

 {{damage=[[@{selected|weapon1damage}]]}}




I was able to code it to get what I want it to do (minus the modifier) using this: 

&{template:default} {{name=Basic Attack}} {{attack=[[?{Attack Type|Standard, 2d10+@{selected|charattackvalue}|Benefit, 3d10kh2+@{selected|charattackvalue}|Hinderance, 3d10kl2+@{selected|charattackvalue}} ]]}} {{damage=[[@{selected|weapon1damage}]]}}

September 28 (6 years ago)

So, you are running afoul of character substitutions.  Try it with only using the substitutions that are in the query that is in the query, not the top level query, or possibly, if it is all one line and not sub-macros, no substitutions.  Also, double check that you are only substituting the characters that need it, there are only a few certain ones.


Also, try doing this as a character ability macro rather than a global game macro, at least until you get it working just right.  Every time you edit a global macro, all the substitutions are parsed out and you break it.

September 28 (6 years ago)

I have no clue what you just said Aranador. If someone can please fix this because I don't know how. I don't know what sub-macros are, or any of that. I don't know how to tell which characters require substitutions and which don't. 

September 28 (6 years ago)

I think this is what you are after

&{template:default} {{name=Basic Attack}} {{attack=[[?{Attack Type
|Standard,2d10+@{selected|charattackvalue}+?{Modifier|0}
|Benefit,3d10kh2+@{selected|charattackvalue}+?{Modifier|0}
|Hinderance,3d10kl2+@{selected|charattackvalue}+?{Modifier|0}
}]]}} {{damage=[[@{selected|weapon1damage}]]}}

September 28 (6 years ago)

Oh my god, thank you so much Kyle! I really appreciate it. This is exactly what I was looking for! :D You're a life-saver!