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

Problem with Math, subtraction and Dices

I don't know if this is possible, but I want a macro to calculate a differance between 2 ratings, but I don't want it to write a negative value. It's a simple subtraction (x-character appearance rating) Any ideas on how to achieve this? I suck at math
1620753304

Edited 1620753421
Solved! [[{{?{how much appearance does your mask have?|1}-@{selected|Appearance},0}>1}*([[?{how much appearance does your mask have?}-@{selected|Appearance}]]-0)+0]]
1620757441
The Aaron
Roll20 Production Team
API Scripter
You can also do: [[ abs( ?how much appearance does your mask have?|1}-@{selected|Appearance} ) ]] See:&nbsp;<a href="https://wiki.roll20.net/Dice_Reference#Rounding_Rolls_and_Math_Functions" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Rounding_Rolls_and_Math_Functions</a>
The Aaron said: You can also do: [[ abs( ?how much appearance does your mask have?|1}-@{selected|Appearance} ) ]] See:&nbsp; <a href="https://wiki.roll20.net/Dice_Reference#Rounding_Rolls_and_Math_Functions" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Rounding_Rolls_and_Math_Functions</a> Just tried, but it didn't work as I was expecting.&nbsp; if the mask is 1 for exemple, and my character appearance rating 5, I wanted the problem to write 0, because that's the amount of blood points the discipline requires.
1620847531
The Aaron
Roll20 Production Team
API Scripter
I don't know anything about the mechanics of the game you're playing.&nbsp; I'm just pointing out the existence of the abs() function for generating the unsigned result of some expression: [[ 1 - 5 ]] will be -4 [[ abs(1 - 5) ]] will be 4
1620847686

Edited 1620847853
The Aaron said: I don't know anything about the mechanics of the game you're playing.&nbsp; I'm just pointing out the existence of the abs() function for generating the unsigned result of some expression: [[ 1 - 5 ]] will be -4 [[ abs(1 - 5) ]] will be 4 Oh, I see. Tried this, but unfortunally it wasn't what I was looking for. I wasn't very clear in specifying that I wanted to write 0 in the chat when the result came back negative. Sorry, my bad.
1620894242
Gauss
Forum Champion
here you go: [[{(A-B), 0}dl1]] Replace A and B with the two values. If negative it will drop the lowest and replace it with 0.&nbsp;
Gauss said: here you go: [[{(A-B), 0}dl1]] Replace A and B with the two values. If negative it will drop the lowest and replace it with 0.&nbsp; wtf, it worked perfectly and it is simpler. tell me how this works mr.wizard
1621607403

Edited 1621609170
Gauss
Forum Champion
(A-B)&nbsp; = the math you want {(A-B), 0}dl1 = tells the system to drop the lowest value between (A-B) and 0. IF A-B is a negative, it is the lowest value compared to 0.&nbsp; [[&nbsp; &nbsp;]]&nbsp; = just puts it in a nice neat answer format (box)
Gauss said: (A-B)&nbsp; = the math you want {(A-B), 0}dl1 = tells the system to drop the lowest value between (A-B) and 0. IF A-B is a negative, it is the lowest value compared to 0.&nbsp; [[&nbsp; &nbsp;]]&nbsp; = just puts it in a nice neat answer format (box) Niiice!