Advertisement Create a free account

Roll Stats & Total them?

1555187354
Is it possible to roll the 6 basic D&D stats, using 4d6k3 and then get a total at the bottom? Here is an example of a working macro that rolls the stats. I just want the total to print at the bottom for easy comparison to other characters. &{template:default} {{name= Character Generation 4d6k3}} {{Strength= [[4d6k3]]}} {{Dexterity= [[4d6k3]]}} {{Constitution= [[4d6k3]]}} {{Intelligence= [[4d6k3]]}} {{Wisdom= [[4d6k3]]}} {{Charisma= [[4d6k3]]}}
1555189634
GiGs
Pro
Sheet Author
You can't do it as a macro - macros dont support saving result of one roll to apply to another total, so you cant total up the rolls and report them as individual rolls. It's one or the other - which is useless for your purpose. You could do it as an API script. 
1555192155

Edited 1555192368
GiGs
Pro
Sheet Author
Here's a script to do this for you. Call it with !sumstatrolls -- in place of &{template:default} So your command would be !sumstatrolls --{{name= Character Generation 4d6k3}} {{Strength= [[4d6k3]]}} {{Dexterity= [[4d6k3]]}} {{Constitution= [[4d6k3]]}} {{Intelligence= [[4d6k3]]}} {{Wisdom= [[4d6k3]]}} {{Charisma= [[4d6k3]]}} Here's the script /*     Roll a bunch of stats and total them. Use this syntax:     !sumstatrolls --{{name= Character Generation 4d6k3}} {{Strength= [[4d6k3]]}} {{Dexterity= [[4d6k3]]}} {{Constitution= [[4d6k3]]}} {{Intelligence= [[4d6k3]]}} {{Wisdom= [[4d6k3]]}} {{Charisma= [[4d6k3]]}}      */ on("ready", () => {      const template = '&{template:default}', sumheader = 'Total Points',     processInlinerolls = function (msg) {         if (_.has(msg, 'inlinerolls')) {             return _.chain(msg.inlinerolls)                 .reduce(function(previous, current, index) {                     previous['$[[' + index + ']]'] = current.results.total || 0;                     return previous;                 },{})                 .reduce(function(previous, current, index) {                     return previous.replace(index, current);                 }, msg.content)                 .value();         } else {             return msg.content;         }     },     totalInlinerolls = function(msg) {         let total = 0;         if (_.has(msg, 'inlinerolls')) {             total = msg.inlinerolls.reduce((total,current) => total + current.results.total ||0,0);         };         return total;     };          on("chat:message", msg_orig => {         if(msg_orig.type == "api" && (msgMatch = msg_orig.content.match('!sumstatrolls --'))){             const msg = processInlinerolls(msg_orig);             const sum = totalInlinerolls(msg_orig);              let output = msg.split('--')[1].trim();             output = `${template} ${output} {{${sumheader}=${sum}}}`;             sendChat("", output);         }     }); });
1555213505
Wow this worked like a charm! Thanks for the above and beyond help!
1555215515
GiGs
Pro
Sheet Author
You're welcome :)
1555325831
Ziechael
Forum Champion
Sheet Author
API Scripter
For the benefit of non-pro users who can't use GiGs more elegant solution, here is an ugly but serviceable way of seeing the total of the attributes... players can then hover over the result to see the individual rolls. Just in case any future forum surfers with the same need come this way :) Attributes: [[ [[ 4d6k3 ]] [Strength] + [[ 4d6k3 ]] [Dexterity] + [[ 4d6k3 ]] [Constitution] + [[ 4d6k3 ]] [Intelligence] + [[ 4d6k3 ]] [Wisdom] + [[ 4d6k3 ]] [Charisma] ]]
1555351065
This is clever, and definitely works in a pinch if  you don't have access to the API solution. Nice! Ziechael said: For the benefit of non-pro users who can't use GiGs more elegant solution, here is an ugly but serviceable way of seeing the total of the attributes... players can then hover over the result to see the individual rolls. Just in case any future forum surfers with the same need come this way :) Attributes: [[ [[ 4d6k3 ]] [Strength] + [[ 4d6k3 ]] [Dexterity] + [[ 4d6k3 ]] [Constitution] + [[ 4d6k3 ]] [Intelligence] + [[ 4d6k3 ]] [Wisdom] + [[ 4d6k3 ]] [Charisma] ]]