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

Need a macro that will make sure a subtraction never returns a negative number.

April 05 (6 years ago)
So I am doing some macros for shadowrun, and I would like to know a function to make sure that if Armor-AP ( @{armor_total}+?{Armor Penetration} ) is less than zero than it's just zero, it doesn't go negative, you know??

can anyone help me with this?
April 05 (6 years ago)
The Aaron
Pro
API Scripter
You can use the keep high one modifier something like:
[[ {( @{armor_total}+?{Armor Penetration} ),0}kh1 ]]
April 05 (6 years ago)
Thank you!! I infact tried that one before but I forgot the [[ ]] so it didn't work.

after seeing your answer I understood why it wasn't working.

Thank you!!
April 05 (6 years ago)
The Aaron
Pro
API Scripter
Great!  No worries.