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] Using Math.max to choose the highest value of three skills (Javascript)

1456288908
MattBx8
Pro
Marketplace Creator
Sheet Author
Hey Folks, I know to use Sheet Worker Scripts to use Javascript but I'm still not very skilled in the coding Javascript. I have built my Buffy the Vampire Slayer character sheet and I'm working on adding the Sheet Rolls for the combat modifiers. I have one combat modifier that is the maximum of three skills plus 1d10. I know that Math.max is the Javascript to use but I don't know how to set it up to create an automatic calculation of the maximum of the three skills to then add in the input field. Any help is appreciated. /Matt
1456289191

Edited 1456289232
Use the _.max() function instead. _.max(list, [iteratee], [context]) Returns the maximum value in list. If an iteratee function is provided, it will be used on each value to generate the criterion by which the value is ranked. -Infinity is returned iflist is empty, so an isEmpty guard may be required.