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

Calling an existing Roll button from macro

Hi all,

Asking for a quick tip here.

Some time ago I created macros for simple combat rolls, to have buttons readily available on the screen without having to open the character sheet to hit the combat skill button all the time.

Here's what this macro looks like:

@{template} {{title=Attaque}} {{dice=[[1d100cs01cs02cs03cs04cs05cs11cs22cs33cs44cs55cs66cs77cs88cf96cf97cf98cf99cf100]]}} {{against=[[@{modifier}+@{MeleeBasic}]]}} {{modifier=[[@{modifier}]]}}

Pretty standard. There's the ugly dice but other than that it just compares the dice roll to my basic melee stat + a prompted modifier.

But in fact, on top of my characteristic table, I have a roll button that already defines that. And now that I have modified this sheet, the roll button has an added argument to it {{hit_location=1}} that makes it display an additional information about which body part was hit, according to the dice roll (all the info is contained simply in the result of the dice roll).

Basically, it seems that if I want to have the same behavior from my macro as I have from the sheet's button, I would now have to add {{hit_location=1}} to my macro code. And then do that for all other macros that make use of this stat.

I'm sure anyone who has experience coding will understand my disgust for having the same instruction being coded at multiple different places.

Especially since I'm not the DM, but I'm the one who maintains our sheet. Meaning if I were to change anything in the character sheet roll, I would then not only need to update my own macros, but tell all my friends (who don't know or want to know the first thing about coding) how to update theirs as well. A surefire way to annoy everyone.

What I would like to have is a way for my melee roll to go through the same formula whether I hit the roll button inside my character sheet or my macro button.

So is there a way, say, to have my macro simply trigger the button in the sheet? Or to create a central macro that both my sheet button or my macro refer to?

January 12 (2 years ago)
GiGs
Pro
Sheet Author
API Scripter

It is possible for a macro to call a button from the sheet, if the button has a name defined. It's code should have something like name="roll_button_name"

Then you can call it with %{character_name|button_name} or %{selected|button_name}