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

Roll Templates Inside API Command Buttons

Is it possible to create an API Command Button that when clicked creates a roll template? I'm trying to get this template: &{template:simple} {{normal=1}} {{rname=Booming Blade Trigger}} {{r1=[[2d8]]}} {{charname=Thunder}} to show after clicking an API Command Button in chat, but none of my attempted combinations of characters and html entities have worked so far. I get the template right away with no button, a button that does nothing or outputs leftover brackets, or just the text inside the square brackets for the button.
1517737068
Finderski
Pro
Sheet Author
Compendium Curator
Have tried making a macro for the output and the have the API/Ability Command Button call that macro?  That's how I've managed it.
I have done it that way. My hope was to have it all contained in a single macro though, and avoid cluttering my list with extras. If it doesn't seem possible though I can fall back to that, or using a different format of output that does work inline.
1517772616

Edited 1517776587
In searching around I came across some comments that made it seem possible <a href="https://app.roll20.net/forum/post/4843035/clickabl" rel="nofollow">https://app.roll20.net/forum/post/4843035/clickabl</a>... <a href="https://app.roll20.net/forum/post/4843035/clickabl" rel="nofollow">https://app.roll20.net/forum/post/4843035/clickabl</a>... but in trying the layout they had with NewLine and replacing '@' I still couldn't get it to work. edit: forgot html entities would be parsed
what sheet are you using?
The 5e OGL sheet
1517777531
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
i'm assuming that you are putting that template code directly in the api command button. There's a few things you need to replace to get this to work: [2d8](!&amp;#13;/&amp;{template:simple&amp;#125; {{normal=1&amp;#125;&amp;#125; {{rname=Booming Blade Trigger&amp;#125;&amp;#125; {{r1=[[2d8]]&amp;#125;&amp;#125; {{charname=Thunder&amp;#125;&amp;#125;)
1517777595
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Note, the &{template:simple in my example should have been: &amp;amp;{template:simple&amp;#125; Didn't properly escape that ampersand.
1517783117

Edited 1517784055
I did try a bunch of variations with the brackets switched out for their html entities, but not quite that one. I also replaced the right braces surrounding the dice roll and got exactly what I was looking for (keeping as braces meant the whole rolling text, "Rolling 2d8 = (4+7)'&gt;11", gets put into the main part of the template). So I have this [2d8](!&amp;#13; /&amp;amp;{template:simple&amp;#125; {{normal=1&amp;#125;&amp;#125; {{rname=Booming Blade Trigger&amp;#125;&amp;#125; {{r1=[[2d8&amp;#93;&amp;#93;&amp;#125;&amp;#125; {{charname=Thunder&amp;#125;&amp;#125;) Thanks for the help! edit: I clearly don't know how to escape entities correctly in this editor Until I figure that out, here's what the final version looks like Ah, that makes sense. Thanks Kyle.
To show the encoded values, you must encode the & in the encoded value. For example &amp;#125; would be entered into this chat as &amp;amp;#125;