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 Needed] Multiple Rolls of Damage

1519920438

Edited 1519920536
Havoc
Sheet Author
API Scripter
Let's say I wanted to roll for damage couple of times. The player clicks on the button, chooses how many times to roll and it rolls. This would be output (the lower one): And every inline roll is: 1d10+X+@{strBonus}. I can't go, from what I remember, query with "?{How many hits?|1, @{damageMacro}|2, @{damageMacro} @{damageMacro}|..." Then how do I do that with API?
1519928484
GiGs
Pro
Sheet Author
API Scripter
If you want to use the API, I'm sure the PowerCards script will be able to do that. You could also create a script to do it, it would be a pretty simple script. I think you could do it without the API if you aren't concerned about presenting the rolls as separate inline rolls, but just wanted the total. If you do need the separate rolls shown, I'm pretty sure that can't be done with normal macros.
1519930534
Havoc
Sheet Author
API Scripter
The problem that it must be done with the roll20 roller - keep/drop functionality is a must. I will look into the PowerCards, thanks.
1519932379
GiGs
Pro
Sheet Author
API Scripter
Here's a fairly simple script that could do with some work on presentation. on("chat:message", function (msg) {         if (msg.type === "api" && msg.content.indexOf("!damage-group") !== -1)         {             let args = msg.content.split("--");             let howMany = parseInt(args[1])||0;             let diceExpression = args[2];             diceExpression = diceExpression.replace("[","[["); // this is just to handle nested inline rolls             diceExpression = diceExpression.replace("]","]]");             let description = args[3];             let output = "";                          for(var i = 0;i < howMany;i++) { // copy the roll expression multiple times                 output = output + "[[" + diceExpression + "]]";             }             output = output + " " + description;             sendChat(msg.who,output);   // replace msg.who with "player|"+msg.playerid" to get player icon                        }     }); You would call this with  !damage-group --3 --2d6+2 --rending attack or !damage-group --?{How Many|1} --2d6+@{selected|STR} --rending attack or !damage-group --?{How Many|1} --4d6k3+@{selected|STR} --rending attack Do not include double brackets in the damage expression, that will cause roll20 to roll it before it reaches the script, and they can't then be duplicated. If you need nested inline rolls, just use single brackets, the script will convert them to doubles. for example: !damage-group --?{How Many|1} --[4d6k3]+[4d6k@{selected|STR}] --rending attack (You dont actually need nested inline rolls in the above example, it's just for sake of example.)
1519932431
GiGs
Pro
Sheet Author
API Scripter
Having said that, PowerCards provides more fancy presentation options and is probably the better option once you figure out its syntax.
1520006888
Havoc
Sheet Author
API Scripter
Thanks for the idea and example! Worked perfectly!
1520027278
Havoc
Sheet Author
API Scripter
It looks sexy now.
1520029053
GiGs
Pro
Sheet Author
API Scripter
That looks great!