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 help with a Macro

1540072504

Edited 1540072647
Can someone help me write a macro I have an attribute for each saving throwing in my game. I need a macro that goes in an looks at the attribute that will be STRSAVE, CONSAVE etc then rolls a d20 and displays how much the save was made or failed by as such: /emas @{selected|token_name} rolls STRSAVE The macro needs to roll a D20 comparing it to the attribute STRSAVE and then say Conan made or failed the save by "X" whatever the amount.  So a low roll on the D20 is good and a high is bad. Id like this  [[1d20+?{Save penalty|0}]] on STRSAVE so that it allows the entrance of a penalty or a positive number ... but they are revered as a positive number would increase the amount making the save worse as low #'s are what you want under the STRSAVE attribute.  Summary D20 roll compared to Attribute that has the save number from the front character sheet. The roll will be higher or lower than the save attribute after the modifier and then display "Made the save by 0 or more or failed the save by 1 or more" Thanks for any help in advance someone could give Ara
So, because you need to return a comparison, and not just a math function, you will probably need an API script.
Hmm ok, I am brand new to the programming and the macro's. I made an HTML character sheet with a lot of trial and error but I do not know the first think about API scripts. Can you give any direction as to what I looking for specifically?
1540076392
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You can do one or the other. You can have the die roll or you can have the margin. You can't have them both and have them agree, because the dice roller doesn't remember numbers. So you could get the margin by something like: /emas @{selected|token_name}'s save result was [[@{selected|STRSAVE}-1d20]] from the target roll of @{selected|STRSAVE} But one way or another, you'll have to do the calculation for the other number in your head. And it can't report a success or failure in those cases. It might be possible to do with the PowerCards API or a specialized Roll Template (i.e., built into the code of the character sheet)
1540076894

Edited 1540076964
Kraynic
Pro
Sheet Author
While it wouldn't do the difference for you, could you just have the macro spit out the target number so you could just see the difference that way? /emas @{selected|token_name} rolls [[1d20]] against a STRSAVE of @{selected|STRSAVE} Hopefully I have the syntax right.  I have been using roll templates exclusively, so I'm not as familiar with the emote type rolls. Edit:  I should have just waited since Keith posted while I was typing.  I'm too slow!
1540078709

Edited 1540078723
This worked, thank you very much for everyones assitance. I am a game designer with 30 years experience but lol my programming knowledge not so much. /emas @{selected|token_name}'s save result was [[@{STRSAVE}-1d20+?{modifier|0}]] from the target roll of @{selected|STRSAVE}