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

Macro Question: Compare 2d10 with +-1 to each other...

1623962662

Edited 1623963556
Hi! I'm a total noob at programming, but I want to try it anyway. It would be lovely if someone could help me :) Here comes my Question : I want to roll 2d10 and wanna compare the two results with each other. Aditionally, I want it to see if the 2d10 are overlap with each other with an range of +-1 .  For example: 1st d10 rolls a 4 2nd d10 rolls a 6 Now, if you add/substract 1 from each roll, you'll get following rows: 1st: {3,4,5} 2nd: {5,6,7} These two sets have the 5 as a element in common, and exactly than I want to see it in roll20 chat like "Your rolls are overlapping!" Aditionally, if they roll the exact same result, I want another message like "Boom! Headshot!" It has no rush at all, but I'm glad for every little help! :) PS: The comments like "Boom!Headshot" is no problem, I've already read a lot in the R20 Macro section! ;)
Numerically what your looking at is the difference between the two rolls where a difference of zero is rolling doubles or a difference of one or two means their sets overlap without being identical or a higher difference meaning the sets don't overlap. This can then be used with the target number system [[ { abs(d10-d10) , {-1} }=0f>3 + 1 ]] This would give you a 0 for no overlapping rolls 1 for overlapping rolls 2 for matching rolls