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 making a simple macro

So I thought I'd ask you guys because I have no idea how this works myself. Basicly I want to make a simple script for attack rolls for a system that I'm working on. This system will work with strength. What I want is for the script to roll a D20 and add your strength to the roll. For example: 1. You have 2 strength. 2. You click the macro to roll a D20 (you role a 17) 3. In chat you see "17 + 2 = 19" How would I go about doing this?
"Scripts" are in the realm of API, and thus Mentor status is needed. You can still so this in a macro using the @{selected|"attribute name here"}. The macro would look like this: /roll 1d20 + @{selected|strength} This is assuming your character has an attribute named strength of course. All your statistics names and values will be in your Attributes and Abilities panel for the character. @{selected} functions when a token is "selected." You can also use @{target|"stat"} and the macro will prompt you to click a target rather then having to have it selected before the macro is clicked. Hope this answers your question.
1404323360
Gold
Forum Champion
/r d20+2 That's how you do it if you know the Strength is 2. If you wanted it to read the Strength off the Character Sheet, that would be a bit more complicated, but can also be done.
1404324348
The Aaron
Roll20 Production Team
API Scripter
It's important to note also that in a macro attached to a character, you don't need selected or target, you can just use @{strength} if there is a strength attribute.
Aaron said: It's important to note also that in a macro attached to a character, you don't need selected or target, you can just use @{strength} if there is a strength attribute. Good to know.
I very strongly recommend you read the dice reference. <a href="https://wiki.roll20.net/Dice_Reference" rel="nofollow">https://wiki.roll20.net/Dice_Reference</a> It goes over everything you need to know about using dice rolls in Roll20
1404344060

Edited 1404344131
Thank you! It's working how I want it now! Thanks a bunch! One more question, but this one might be asking too much: Is there a way to play a sound from the audio library while using this macro? /roll 1d20 + @{selected|strength} + playSound{Punch} Or something?
1404346462
The Aaron
Roll20 Production Team
API Scripter
Nope, not even with the API.
Alright, gotcha!