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

Can I build Ability Command Buttons inline?

Can I build my Ability Command Buttons without actually linking to another Macro? In that I would like to nest macros within them, but I don't want those nested macros to be their own. I would like everything to be self contained in one macro.
1494781840
Silvyre
Forum Champion
I'm not quite sure I understand what you mean. Maybe describe a use case?
1494782286
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Not with ability command buttons, but you can with  API command buttons (no subscription required). Depending on the content of your macros, you may need to html encode some characters. I'd mostly recommend using ability command buttons and discrete abilities unless you are trying to pass the results of a roll query from macro stage to macro stage.
1494782624
Silvyre
Forum Champion
Right, as Scott said you can write an API Command Button that contains a macro. For example: [Roll Dice](!
 [[ ?{Dice|2d6} ]])
1494790160

Edited 1494791489
The other day I was creating the Saving Throw Macro on the D&D threat that you helped me out a bunch with Silvyre. I'd like to possible try also creating a macro that shows a list of these these in chat (similar to the Pathfinder Character sheet). Basically, I would like to use the NPC Action Template, and within it have a button for each Save (keep in mind, I'll be doing this for other things other than saves too, it's just the most complicated one because of how the bonus is calculated for NPCs), which when clicked presents and NPC template that rolls, using the sheet's preference for rolling advantage / disadvantage. I can see from your example that you have a lot more html in this, and it looks like that may be where I'm stumbling. Even getting something as simple as shown below isn't showing the template sheet when I click it. Instead in chat it shows {{template:npcaction}} @{selected|wtype} &{template:npcaction} {{name=@{selected|token_name}}} {{rname=Saves}} {{description=[Strength Save](!
@{selected|wtype}{{template:npcaction}&amp#125;)}}
For more clarity. I can get this to work fine. But this is linking to 6 extra macros I've created. I'd like to get rid of those 6 other macros, and have all of the code in one convenient macro. It produces the image below. @{selected|wtype} &{template:npcaction} {{name=@{selected|token_name}}} {{rname=Saves}} {{description=[Strength](!
#SaveSTR) [Dexterity](!
#SaveDEX) [Consitution](!
#SaveCON) [Intelligence](!
#SaveINT) [Wisdom](!
#SaveWIS) [Charisma](!
#SaveCHA)}} And in the macro this references the following. @{selected|wtype}&{template:npc} {{rname=Constitution Save}} {{name=@{selected|token_name}}} {{r1=[[1d20+[[@{selected|npcd_con_mod}*{1@{selected|npcd_con_save}0,0}=10+0@{selected|npcd_con_save}]] [CON SAVE]]]}} @{selected|rtype}+[[@{selected|npcd_con_mod}*{1@{selected|npcd_con_save}0,0}=10+0@{selected|npcd_con_save}]] [CON SAVE]]]}}
1494807720
Silvyre
Forum Champion
Jeremy R. said: And in the macro this references the following. @{selected|wtype}&{template:npc} {{rname=Constitution Save}} {{name=@{selected|token_name}}} {{r1=[[1d20+[[@{selected|npcd_con_mod}*{1@{selected|npcd_con_save}0,0}=10+0@{selected|npcd_con_save}]] [CON SAVE]]]}} @{selected|rtype}+[[@{selected|npcd_con_mod}*{1@{selected|npcd_con_save}0,0}=10+0@{selected|npcd_con_save}]] [CON SAVE]]]}} Here's this macro within an API Command Button: [Constitution](!/
 @{selected|wtype}&{template:npc} {{rname=Constitution Save}} {{name=@{selected|token_name}}} {{r1=[[1d20+[[@{selected|npcd_con_mod}*{1@{selected|npcd_con_save}0,0}=10+0@{selected|npcd_con_save}]] [CON SAVE]]]}} @{selected|rtype}+[[@{selected|npcd_con_mod}*{1@{selected|npcd_con_save}0,0}=10+0@{selected|npcd_con_save}]] [CON SAVE]]]}}) I added a forward slash (/) before the first colon (:) to work around an issue with colons .
1494901808

Edited 1494902068
Success, I've created versions of Saves using proper bonus' and ability checks both with dropdown, and with API Command Buttons! Many thanks to all those helping get these sorted out! I'd like to make sure others are able to find these. I wasn't able to get so many html characters to come across properly, so I've made the .txt file where I've saved them available  here .
Silvyre said: Right, as Scott said you can write an API Command Button that contains a macro. For example: [Roll Dice](!
 [[ ?{Dice|2d6} ]]) I'm curious why do we use the carriage return character in there? Is that just what's needed to make them work? Seems like an odd syntax.
Yeah, it's a hack that makes it work. Not really intended behavior I think, but hey... it suffices for now.