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

Trying to put a chat button with a roll template call inside my custom roll template

1735160738

Edited 1735160990
Does anyone know if this is possible? <span class="sheet-dcalc" title="Select target token, then Click">[Damage](`%NEWLINE%&{template:default}{{damage=[[8]]}})</span> This code is the basic idea. I can set up chat buttons that will take the damage and compare it to the damage resistance on a character sheet. I want to put this as a chat button inside my custom template.  I can use other commands inside the button, but if I put a template call, the button is just replaced with "Damage". I have tried turning symbols into entities, and it won't work. If i do a double escape on the symbols (like {), it just causes an error.
1735166376

Edited 1735166514
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
It is possible but it needs to use custom roll parsing to use JavaScript to assemble the button. You can look at the official alien, blade runner, dragonbane, and walking dead sheets for some working (although complex) examples. Edit: you can also see Oosh's Adventures in Startroll forum thread for explanations of the basic techniques of data passing and other advanced uses of startRoll.
Thank you. I actually have the crazy complex roll parsing stuff worked out, mostly. It just seemed like this should work as a test, before finishing it all
I think I get it now. You use a call to a 2nd action button, and hide an extra string in the call:  "{button}(~seleted|secondbutton||extrastring)" Then, you collect the extra string from the originalRollId. This is great. Way neater than what I had been trying.
1735172412
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, note that I recommend using the base64 encoding for the data you're passing so that you can pass what ever you need to.