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 help needed

1540838850

Edited 1540838913
Hello, can anyone tell me if what I am trying to do here is possible with a  macro? The game system gives a base to hit# of 12 subtracting minus modifiers than roll a d20. For example:  A warrior has a To hit number after modifications of 5 (which is 7 pluses)  so if he rolls a D20 and rolls a 20 he "hits by 15".  The below Macro works /emas @{selected|token_name} makes an attack and hits or misses by  /roll 1d20- ?{Adjust Hit #|12} Here is the problem ... If the modified number he has is below 0 ... meaning he has say 14 pluses making his base to hit # -2 the macro does not work. Can anyone help me with this issue? Thanks in advance Ara
1540839628

Edited 1540840000
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
What is supposed to happen at a negative total? Using basic math, that should then be the opposite (increasing the difficulty as the number becomes more and more negative) , but maybe this isn't what you want. EDIT: I see what's suposed to happen based on Keith's macro.
1540839744

Edited 1540839884
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The parser wants to know that a negative number is negative, and that parses out to --#. I needs to parse to -(-#), so this should work, using parentheses: /roll 1d20- (?{Adjust Hit #|12}) EDIT: Had to fix the formula to give a random 1d20 roll. I had made it static for testing.
Perfect, Thank you so much gents!