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 .
×

Macro of Average for two Attributes

Hi guys pretty new at this. Just starting writing own macros. One I can not figure out for our game is I want get the average roll of a characters highest and lowest attribute. I realize I will probably have to copy paste the specific high and low attributes of each character but looking for a general formula.  Any help is appreciated.
1625027143
timmaugh
Roll20 Production Team
API Scripter
Something like this: [[(@{selected|Charisma} + @{selected|Wisdom})/2]] You can replace "selected" with a character's name. If you put this roll on a character sheet (say, in an ability), you can omit the "selected" or character name, entirely. This does require you to determine the highest/lowest. With the API (if you're playing in a game started by a Pro subscriber), MathOps could handle getting the highest and lowest attribute dynamically (with a max() and min() function): {& math (max(@{selected|Strength},@{selected|Dexterity},@{selected|Consitution},@{selected|Intelligence},@{selected|Wisdom},@{selected|Charisma}) + min(@{selected|Strength},@{selected|Dexterity},@{selected|Consitution},@{selected|Intelligence},@{selected|Wisdom},@{selected|Charisma}))/2}
1625027177
The Aaron
Roll20 Production Team
API Scripter
Do you mean something like this? [[ ( @{selected|attr1} + @{selected|attr2} ) / 2 ]]
1625028226
timmaugh
Roll20 Production Team
API Scripter
1625053195
GiGs
Pro
Sheet Author
API Scripter
And if you want to show only whole numbers, you can use floor(round down), ceil(round up), or round(round to the nearest), like so [[ round( (@{selected|attr1} + @{selected|attr2}) / 2) ]] o, if you don't want to use inline roll brackets /roll round( (@{selected|attr1} + @{selected|attr2}) / 2)
Thanks Guys! You all are the best. Got it working perfectly. Think I was adding random "roll 20" that weren't required.