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

[HELP] Multiple inline rolls with dropdown

I'm playing a druid with Conjure Animals, and trying to streamline using them in combat - rather than rolling for 8 (or more) creatures individually, I want to be able to click a macro which will roll all of their attacks for me.  I also want to be able to take into account if they will be attacking at with Advantage and Disadvantage.  Here's the macro I have for one attack: [[ ?{Roll Type|Standard, 1d20|Advantage, 2d20kh1|Disadvantage, 2d20kl1} + ?{Skill Bonus|0}]] What I'd like to be able to do is to be able to have this same macro run up to 8 times, or more, at higher levels.  But I can't figure out how to make it work.  I can simply repeat this macro 8 times, and then just use the first two, or four, for example.  But, I'd prefer a query that would allow me choose the number of creatures and then run the macro that number of times.  I'm sure it can be done with nested queries and possibly html replacements, but I can't quite make it work. Can anyone help me?
Try this !?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1} ?{Skill Bonus|0} ?{Number of rolls |1,[[?{Roll Type}+?{Skill Bonus}]] |2,[[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |3,[[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |4,[[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |5,[[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |6,[[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |7,[[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]]     [[?{Roll Type}+?{Skill Bonus}]] |8,[[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |9,[[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |10,[[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] }
Yes!  That works great!  Thanks! What is the purpose of the first line?  On the roll template I use, it shows the formula for the roll, which is nice, but does it serve another purpose?  I thought that the ! was only to trigger API commands.
1523072417
GiGs
Pro
Sheet Author
API Scripter
Any line that starts with ! wont be printed to chat, so macro writers often use it for neatness, or for ensuring prompts appear in the order they prefer. In this macro, it might be to reduce the number of characters that need to be replaced with html, but it's more likely just for neatness.
Oh, interesting.  It does print to chat for me, but probably because I'm using the 5e-shaped roll template and putting the macro in as "freetext."
1523078966

Edited 1523078998
GiGs
Pro
Sheet Author
API Scripter
The rolltemplate will be overriding that. You can change the macro to avoid it printing. Change this line: |1,[[?{Roll Type& #125;+?{Skill Bonus& #125;]] to |1,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,2d20kl1& #125;+?{Skill Bonus|0& #125;]] Remove the spaces I put after both & symbols since I can never remember how to get those characters to show up here., You only need to change them on that one line. And remove the first line, with the !
No, changing that line messes up something with the query:
1523087484

Edited 1523087571
GiGs
Pro
Sheet Author
API Scripter
Ah, oops, I forgot you also need to replace the "," and "|" with html equivalents. I've tested it this time. this works: replace the first 3 lines of the macro with these two lines: ?{Number of rolls |1,[[?{Roll Type& #124;Standard& #44;1d20& #124;Advantage& #44;2d20kh1& #124;Disadvantage& #44;2d20kl1& #125;+?{Skill Bonus& #124;0& #125;]] Remove the spaces after each "&" PS: i see now why the ! method was used in this macro :) So much simpler without those html replacements.
Ok, that works if I roll 1 die, but if I roll any others, the Roll Type and Bonus are not defined, and the macro doesn't run. Maybe it's just better to use the first way...
1523102130
GiGs
Pro
Sheet Author
API Scripter
Ordinarily you should only have to declare a query once, but I'm guessing the fact its using html replacements, is stopping roll20's parser from declaring them properly. Maybe Kyle has a better solution, otherwise you may just have to deal with that first line being printed.
Yep.  Thanks for your help guys!
This will work for what you want ?{Number of rolls |1,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,}+?{Skill Bonus|0}]] |2,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,}+?{Skill Bonus|0}]] [[?{Roll Type}+?{Skill Bonus}]] |3,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,}+?{Skill Bonus|0}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |4,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,}+?{Skill Bonus|0}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |5,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,}+?{Skill Bonus|0}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |6,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,}+?{Skill Bonus|0}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |7,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,}+?{Skill Bonus|0}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]]     [[?{Roll Type}+?{Skill Bonus}]] |8,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,}+?{Skill Bonus|0}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |9,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,}+?{Skill Bonus|0}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] |10,[[?{Roll Type|Standard,1d20|Advantage,2d20kh1|Disadvantage,}+?{Skill Bonus|0}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] [[?{Roll Type}+?{Skill Bonus}]] } The reason being that you need to replace the first query in each line with the code that G G provided above. Queries are not processed until they are needed, so even though there was an instance of the full query in the overall query, it was never triggered and therefore was not already processed to substitute the result. This was the original purpose for putting the query for roll type and modifier before the query asking how many rolls. G G said: I can never remember how to get those characters to show up here. replace & with &
That did it!  Thanks!