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

Possible to Call Roll Template via Ability Command/API Command Buttons?

1506811063

Edited 1506812019
GM Matt
Sheet Author
Is this possible? (I think that's how it works in 5th Ed SRD?) I've been experimenting with it for the last few minutes, and can't figure out how to make it happen. E.g., [Possibility](&{template:default} {{Name=Test}} {{Hello=World}}) Doesn't work. Edit: One additional question: if I set up a button to call a roll template from within another roll template, can I pass on the variables from one to the next?
1506812138

Edited 1506812177
vÍnce
Pro
Sheet Author
I think you might have to create a macro then call it from another macro as an API command button. example #hello_world &{template:default} {{Name=Test}} {{Hello=World}} to place a button in chat , you could call the above macro using (you'll need to substitute "!" with a special character code; !
 ) [Hello World](!
#hello_world)
1506812257
vÍnce
Pro
Sheet Author
Scott and Aaron have a great post on this here:&nbsp;<a href="https://app.roll20.net/forum/permalink/3841043/" rel="nofollow">https://app.roll20.net/forum/permalink/3841043/</a>
@Vince- Thanks for taking the time to reply and for the link. I also note some&nbsp; language from the Wiki which suggests that Ability Command Buttons can call sheet button rolls. I do have a sheet button that calls on this particular roll template. Any idea how I can get at that sheet button?
1506814918
vÍnce
Pro
Sheet Author
GM Matt said: @Vince- Thanks for taking the time to reply and for the link. I also note some&nbsp; language from the Wiki which suggests that Ability Command Buttons can call sheet button rolls. I do have a sheet button that calls on this particular roll template. Any idea how I can get at that sheet button? You can try hovering over the button and see if the name of the button roll is given, (you could also right-click and inspect the element to learn the buttons attribute name) or dragging the button to the quickbar, click the button and use the up arrow in chat.
1506816398
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
For ability command buttons, to call a sheet roll button, it's the same syntax as calling a custom abilities (sheet roll buttons and custom abilities are essentially the same). So you'd simply do [Button Label](~Char Name|sheet_roll_name)
Thanks again for all the help, Scott and Vince. So I think I'm getting there... One last question. If I just want to use the sheet for the name or id of the character that originally called up the roll template as the keyword, how do I do that? I've tried two or three variations, including (~@{character_id}|sheet_roll_name) and just plain (~character_id|sheet_roll_name) with no luck.
1506821523
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The ability command button doesn't use the character id, it uses the character name. So, you could do this: [Button Label](~@{character_name}|acrobatics) Note that there is no difference between that and just typing the character name in (although you would be able to then copy and paste it to any character and have it work). You could also use the selected or target keywords in place of the character name (it will look for the target/selected token when the button is clicked).
1506822274

Edited 1506822359
GM Matt
Sheet Author
I'm getting "TypeError: Cannot read property 'substring' of undefined" when I attempt to reference the current character in that manner. I probably didn't make this clear earlier, but right now I am trying to make this call out of html in a roll template. Here is the actual line, with your suggestion: &lt;tr&gt;&lt;td&gt;&lt;span class="tcat"&gt;[Possibility](~@{character_name}|possibility-roll)&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; The irony is that right now, I don't even *care* which sheet gets called. At the moment, it will execute the same from every sheet. I suspect I could make this work with "selected" or "target" - but that just creates unnecessary work for the user.
1506822705

Edited 1506822930
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, are you trying to make a button on the sheet that the player can click to initiate a roll? That is handled via&nbsp; sheet roll buttons . The ability command buttons (and API command buttons) are only for chat buttons. There is a similar syntax for&nbsp; journal command buttons to be used inside handouts or the bio/gmnotes of a character. EDIT: Or are you trying to put the command button directly into the roll template code? I'm pretty sure that won't work as that syntax requires that it be sent from a character sheet so that the @{character_name} attribute call is linked to a specific character. I'd recommend programming this into the sheet roll button with a field in the template that expects that button.
The latter (putting button into roll template code). I could swear that this is what 5th Edition SRD is doing when you click a hyperlink to add damage to an attack roll, but maybe I'm wrong.
1506823237
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, they're doing what I suggested as the alternative, it is programmed into the roll button: &lt;button name='roll_SomeRoll' value='&{template:someTemplate} {{name=yadayada}} {{rollname=[Call to damage roll](~@{character_name}|damage_macro)}} Note that they are probably actually putting this into a macro attribute that the button then calls.
Thanks, Scott. I'll play around with that and see if I can make it work. Appreciate your time.