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

API command button usage in macros

March 15 (10 years ago)

Edited March 15 (10 years ago)
I'm trying to create a macro that puts out the API command buttons and when I click on the button it uses another macro. (For example I want to do secret Ability score checks on my players)

So I have tried:
/w GM &{template:default} {{name=Ability Score check}} {{[INT](!#Int)}}

And then:
/w GM &{template:default} {{name=Ability Score check}} {{[Intelligence](<a href="!INT">#INT</A>)}}
I also tried the above with the # and ! reversed.

In both cases nothing happens.

Is what I'm attempting possible using macros or will I need to make an API script?
March 15 (10 years ago)
Lithl
Pro
Sheet Author
API Scripter
API command buttons work just fine in roll templates. However, be aware that you're not specifying a property name (although that apparently defaults to the empty property name if you don't give any at all), and if #Int is supposed to be a macro invocation, you'll need a space after it otherwise it will be interpreted as simply the text "#Int".
March 15 (10 years ago)

Edited March 15 (10 years ago)
Ok how about I just go to basics because I'm not getting how to use the API command button properly. (Also thanks for pointing out the macro invocation)

How do I make the button invoke a macro #macro?

EDIT: I', using [TEST](!#macro) and it's letting me press it but the results from the #macro aren't being sent to the chat (I see the 3d dice roll)
If I add a space to !#macro it causes the roll to happen without the button being printed
March 15 (10 years ago)
The Aaron
Pro
API Scripter
Officially, you don't. They are intended for invoking API commands.

I've seen some hacks that allowed them to invoke macros, but I don't know if they still work.
March 15 (10 years ago)

The Aaron said:

I've seen some hacks that allowed them to invoke macros, but I don't know if they still work.

CGen is entirely built around this hack actually.
March 15 (10 years ago)
The Aaron
Pro
API Scripter
Oh! Great! :)