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

Conditional Expression Troubles

Hi all, hoping I could get some help regarding making a if/then with an API script. I've wrapped my head around Macros, but I'm not familiar enough with Java Script to create my own solution. Currently I'm trying to wrangle a solution to the following: I want to get a script running that will to a 4dF roll with an attribute with a minimum possible value equal to a second attribute. Or, to put it another way... Roll (4dF+Combat Attribute) = Result; IF Result < Defense Attribute THEN show Defense Attribute; ELSE show Result I'm currently trying to pull this off with Extended Expression script and while I could get the author's similar example to work, I just can't wrangle a result with what I want, even if I just change the elements in the example script. For one, the script doesn't like inline dF rolls and only gives a 0 result, even with modifiers to raise the possible values above 0. Second, well, second again is that I'm not very familiar with scripting so as a result when I try and write out the script myself it doesn't recognize my roll. Any guidance, advice, or an up-to-date script of the same nature would be a big help. Thank you!
You can do this without an API Script using a {}kh1 function : [[ {4dF + @{combat}, @{defense}}kh1 ]]
That works! I was so hung up on getting a Boolean working, I didn't think of using keep/drop. Thank you Silvyre!
You're very welcome! Happy rolling!
1494196801
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Elegant solution!