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

Use a new var created inside roll template

Hello, Second topic but for a different problem, it's my first try with custom roll template and I'm stuck on a Math problem I would like to calculate the number of dice to throw (Attribute + Modifiers) then use this var inside another one &{template:vermine} {{name=@{character_name}}} {{ totalDice =[[@{Vigor}+@{Physical_Pos1}+@{Physical_Pos2}-@{Physical_Neg1}-@{Physical_Neg2}+ ?{modifier|0}]]}} {{throw=[[ {{totalDice}} d10]]}}"/> You have the spirit, is that even possible ? Second though, is it possible to display result of each dice instead of the total result ? " I would like to know how many dice rolled more than 5, I saw " {{#rollGreater() <rollname>}} " but it seems to only works with the total result and not each rolls
1570407008

Edited 1570407751
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Unfortunately, the answer to both of your questions is no. For your first question, you can just do: {{ totalDice =[[@{Vigor}+@{Physical_Pos1}+@{Physical_Pos2}-@{Physical_Neg1}-@{Physical_Neg2}+ ?{modifier|0}]]}} {{throw=[[[[@{Vigor}+@{Physical_Pos1}+@{Physical_Pos2}-@{Physical_Neg1}-@{Physical_Neg2}+ ?{modifier}]]d10]]}} and get essentially the behavior you were after, but you can't do math (aka inline rolls) within the definition of the roll template. The roll template definition is only for conditional display of the fields. For your second question, it isn't possible to display the result of each die separately easily. If the modifier could be asked in the sheet, then the roll could be assembled by a sheetworker so that each roll was made as a separate inline roll. If the modifier has to be a roll query, then your only option is rolling some arbitrarily large number of d10s and then selectively displaying them in the roll template as needed based on how many rolls were actually needed; note that you won't be able to actually add them together in this case. Can you elaborate on the system mechanic here? Do you care about the total of the xd10? or just how many rolled a 6 or better? If all you care about is the number of successes, then you could just change to using the success/failure syntax: {{throw=[[[[@{Vigor}+@{Physical_Pos1}+@{Physical_Pos2}-@{Physical_Neg1}-@{Physical_Neg2}+ ?{modifier|0}]]d10>6]]}}
Thanks for your answer For the result I would need to know each result, when opposed to an easy roll, players need to get 5< result for a success, for a hard task 7< and for a very hard task 9< I would like to display : Nb of dice (Attributes - Character Sheet) Nb of dice (Temporary Modifier - Character Sheet) Nb of dice (Instant Modifier - Modal inside the roll) Total of dice Result of each dice Total easy success Total hard success Total very hard success
1570551742
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The only way to handle all that is really just to use the hover tooltip for the inline roll. There's no way to get all of that directly in the roll template short of an api script solution.