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

Trigger rolltemplate from roll template

June 21 (3 years ago)
.Hell
Sheet Author

Hey,


I would like to have the possibility to click on the word in a roll template to trigger another rolltemplate. Is this possible? Can I somehow transfer data between the templates?


Thanks

June 21 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

https://wiki.roll20.net/Chat_Menus has info on how to do it. You know how if you have the 5E sheet to not auto-roll damage, the button to roll damage is done the same way.

June 26 (3 years ago)
.Hell
Sheet Author

Hey Andreas,


apparently I am doing something wrong and cannot get it to work.

This is the roll I want to reference.

<label class='sheet-fumbletitle' data-i18n="fumble-u" >FUMBLE</label><button class='sheet-fumble-roll' type='roll' name="roll_fumble" value= '@{whisper}&{template:fumble} {{title=FUMBLE}} {{name=@{character_name}}} {{roll=[[1d10!+1]]}}'></button><br />


And this is the roll template I want to refrence it in:


<table>
<tr><th style='text-transform: uppercase;'>{{title}}</th></tr>
<tr><td><strong class="template-title">NAME: </strong> {{name}}</td></tr>
<tr><td><strong class="template-title">SKILL ROLL: </strong> {{roll}}</td></tr>
{{#rollWasCrit() roll}}<tr style='text-align: justify; font-size: 12px;'><td><strong class="template-title" style='color: #66c600; text-shadow: 1px 1px #000;'>CRITICAL:</strong> Criticals are already calculated into the roll</td></tr>{{/rollWasCrit() roll}}
{{#rollWasFumble() roll}}<tr style='text-align: justify; font-size: 12px;'><td><strong class="template-title" style='color: #c60000; text-shadow: 1px 1px #000;'>FUMBLE:</strong> Use the [fumble](&#126;fumble) button, **subtract** the result from your total score.</td></tr>{{/rollWasFumble() roll}}
</table>

I tried it with [fumble](~fumble] and the escaped variant both write in chat: TypeError: u is undefined

What am I missing?

June 26 (3 years ago)

Edited June 26 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter

You need to include which character sheet the ability roll is on, like:

 [fumble](~NAME|fumble]

Change NAME to the relevant character sheet name, or selected.

When a button is rolled from the character sheet, roll20 knows which sheet it is coming from. When you click a button in chat, roll20 cannot tell which character sheet's button you want to use, so the information has to be included.

I'm still waking up so I cant remember how to generate the character sheet name automatically, to send with the rolltemplate, but I'm sure someone else will or this might point you in the right direction.

June 27 (3 years ago)
.Hell
Sheet Author

Hey Gigs,

thanks for the tip. I had the name in the rolltemplate anyway and could just use it. Now it works, thanks!

June 27 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter

Great :)

June 28 (3 years ago)
.Hell
Sheet Author

I tried to style the button but didnt get it to work. Is there a specific trick to it? I tried to simply overwrite it like written https://app.roll20.net/forum/post/7209333/show-off-your-style/?pageforid=7455586#post-7455586 or https://app.roll20.net/forum/post/7129900/css-makeover-for-default-template but that didnt work. Also being more specific did not change a thing.

June 28 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter

In your links, Keith is using Stylus, a browser extension that only changes the style for him - each player who wants to use this style needs to install Stylus and set it up properly.

It is possible to style a button created via a rolltemplate, but you need very specific CSS to do it. Post the html for your rolltemplate (at least its name0, and the html for your button, and the css you'd like to apply to the button.

June 28 (3 years ago)
.Hell
Sheet Author
<rolltemplate class="sheet-rolltemplate-reputation">
<table>
{{#rollWasFumble() roll}}
<tr style='text-align: justify; font-size: 12px;'>
<td class="sheet-test">
<strong class="template-title" style='color: #c60000; text-shadow: 1px 1px #000;'>FUMBLE:</strong> Use the [fumble](~{{name}}|fumble) button, **subtract** the result from your total score.
</td>
</tr>{{/rollWasFumble() roll}}
</table>
</rolltemplate>


We can go with this styling, when it works I can tweak it myself :)


.textchatcontainer a[href^="~"] {
    background-color: transparent;
    padding: 0px;
    color: #ce0f69;
    display: inline-block;
    border: none;
}

Thanks for the help

June 28 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter

For styles within a rolltemplate, you need to include the rolltemplate. So the above CSS should start

      .rolltemplate-reputation a[href^="~"] {

That will catch all buttons in the rolltemplate that use ~

If you're using legacy code, that would be

      .sheet-rolltemplate-reputation a[href^="~"] {


June 28 (3 years ago)
Kraynic
Pro
Sheet Author

I don't think anything has changed with how roll templates need to be written in their html/css. 

Note Regarding Roll Templates

Because chat is closely integrated into the VTT, roll templates will continue to use the legacy system, both for CSS and HTML.

From the first post here:

https://app.roll20.net/forum/post/9883156/character-sheet-enhancements/?pagenum=1
June 28 (3 years ago)
Finderski
Pro
Sheet Author
Compendium Curator

Yeah, CSE doesn’t apply to roll templates, so still need the sheet-

June 28 (3 years ago)
GiGs
Pro
Sheet Author
API Scripter

Aha, thanks for the correction.

June 28 (3 years ago)
.Hell
Sheet Author

Thanks for all the help. My error was to keep the textchatcontainer. I got it to work how I wanted it. I really appreciate all your help :)