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

How do i link rolls results in the same action?

I'm playing the fallout roll20 system here and i want to personalize the dices for some perks. This is the code im using: &{template:fallout_damage} {{weaponName=Asesino}} {{showDice=1}} {{playerName=Lenora }} {{lastRoll=lastRoll}} {{num_rolls=4}} {{damage=[[1]]}}  {{roll1=[[1d6cs7]]}} {{roll2=[[1d6cs7]]}} {{roll3=[[1d6cs7]]}} {{roll4=[[1d6cs7]]}} But it always shows the result as 1. In the sistem you roll some dices and add the results but it shows the 4 dices with different results and the main result still 1. How do i link the rolls results to show as the damage results? I know the result here is what is going to show  {{damage=[[1]]}} but i dont know how to link with the other 4 dices
1714590537

Edited 1714590587
timmaugh
Pro
API Scripter
In order to total the rolls, they need to be totaled from the beginning. That is, you can't render a roll in one place, then later refer to it using it's roll marker syntax (ie, $[[1]] ) as a part of a new roll. (I should say, the above is true unless you have access to scripts... at which point you can use roll in later calculations and further rolls.) What you want to do is known as re-using rolls , though really it's more about "re-reporting" them. Construct your more complex roll (the total of all of these individual rolls) first, then report out the individual ones later. [[ [[1d6cs7]] + [[1d6cs7]] + [[1d6cs7]] + [[1d6cs7]] ]] Then your roll indices are controlled by an inside-out, left to right process: if the roll contains sub-rolls, those are evaluated left-to-right, looking for sub-rolls that would take us back to the top of these instructions when we encounter a roll with no sub-rolls, it is resolved and assigned the next roll index (starting with 0) we move to the next sibling roll (starting again at the top of these instructions, looking for sub-rolls), or to the parent roll (if there is one) That means in the above roll (a parent roll with four children), the children rolls will get evaluated first. They will receive indices as follows: [[ $[[0]] + $[[1]] + $[[2]] + $[[3]] ]] Then the parent roll will be evaluated and assigned the next index, $[[4]]. In your case, it sounds like you want to display this result as your damage field, so that means you could put the parent roll there and call it good. However, you might later encounter a case where you don't want to display the outermost roll, but you need it for particular math along the way. In that case it's good to remember the trick that  you can put nearly anything between template parts and have it not show in your output. I'll rewrite your above macro using this method so that it's clear how to do that next time: &{template:fallout_damage} {{weaponName=Asesino}} {{showDice=1}} {{playerName=Lenora }} {{lastRoll=lastRoll}} {{num_rolls=4}}  [[ [[1d6cs7]] + [[1d6cs7]] + [[1d6cs7]] + [[1d6cs7]] ]]  {{damage=$[[4]]}}  {{roll1=$[[0]]}} {{roll2=$[[1]]}} {{roll3=$[[2]]}} {{roll4=$[[3]]}}
1714598963
GiGs
Pro
Sheet Author
API Scripter
Sinfce Tim has done a thorough job of explaining, I'll add that this part: [[ [[1d6cs7]] + [[1d6cs7]] + [[1d6cs7]] + [[1d6cs7]] ]] must be on the same "line" (same rolltemplate) as the place you show the output $[[0]], but you don't need to put it inside {{ }} brackets - in fact, you usally don't put them in such brackets, because you want them to be ignored by the rolltemplate. Entities like $[[0]] are not actually numbers, they are objects that contain numbers. This means you cant perform arithmetic with them ($[[0]] *3 won'twork), but rolltemplates do properly interpret the number so if you have rolltemplate logic like rollGreater{} that will still work with them