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

Multiple roll templates in the same sheet

1733654711
StéphaneD
Pro
Sheet Author
API Scripter
Hi all The question is in the title of this post : can you have mutliple <rolltemplate> elements in a single character sheet html file ?
1733655749
vÍnce
Pro
Sheet Author
Yes (if I understand your question).  There are many sheets that have multiple roll templates.  You could have one for attacks, spells, general, etc.  Then just use their name in the macro as needed. ie &{template:attacks}, &{template:spells}, &{template:general}, etc. 
1733656648
StéphaneD
Pro
Sheet Author
API Scripter
Hi Vince Yes, that's my question. So you insert multiple <rolltemplate> elements in your html, after the main sheet div and before the <script> element with your sheetworkers, right ? You give it a class of sheet-rolltemplate-xxx and the you'll use &{template:xxx} as a prefix for your rolls in chat, right ? So if one wants to add "Jakob's better default roll template" in their new sheet in the works, it shouldn't be harder than going to Jakob's gist, copy the CSS and HTML parts in their own CSS and HTML file and there you have it ? Well, if we're having this conversation, it is because Roll20 makes it not as easy as it seems. The above describes and illustrates what I have done. And of course as soon as I try a roll such as &{template:custom} {{title=Titre}} {{subtitle=Sous-titre}} {{desc=Description}} {{Base=1}} {{CHA=2}} {{Liste Buffs=truc: 1; bidule: 1}} {{Total Buffs=2}} {{Total=5}} Then the CSS is simply ignored and all the text is spitted out without any formatting Any idea what I'm doing wrong ?
1733670565

Edited 1733670636
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Roll template css is VERY finicky. You have to have the .sheet-rolltemplate-xxx prepend on all css for your roll template and all your classes have to have .sheet- prepended on them (with a few edge case exceptions). The roll template sanitizer is also very strict and might throw your css out for any number of "security" reasons. Aside from general guidance we can't really help without seeing the code (html and css).
1733673577

Edited 1733673715
StéphaneD
Pro
Sheet Author
API Scripter
Hi Scott Well I had inserted screenshots in my prior post but Roll20 forums decided they were not worth it. Also as said in my prior post, I just copied the code from Jakob's gist without changing anything, so it has all the .sheet- classes prefixes that are required Not having access to Roll20 sanitization (except when they decide to remove inline styles from HTML and break my sheets), and given the high level of useful documentation they give us, I have not the littlest idea of what is not secure in this code. It was provided by a reknown Roll20 community member, so I would trust it. Here is the code from Jakob that I inserted in my own (screenshots from a game I have setup with custom sheet) First the HTML, between my own (which does output to chat with CSS styles)&nbsp; and the SW script part of the sheet &nbsp; And here is the CSS, also copied from Jakob's gist and pasted at the end of my own CSS without changing anything in it You do not have everything listed above, but trust me when I say that the only technical thing I did was using key combinations on my keyboard (namely Ctrl+C and Ctrl+V) and clicking a button to save my changes, first in VSCode, then in my test game. However, you can check the whole thing at this Github repo :&nbsp; <a href="https://github.com/stephaned68/COF2e/tree/main" rel="nofollow">https://github.com/stephaned68/COF2e/tree/main</a> TIA for any help :)
1733689995

Edited 1733690026
vÍnce
Pro
Sheet Author
Try closing the first line's comment ie */ /* Jakob's better default roll template for Roll20 /* <a href="https://gist.github.com/joesinghaus/28173990b3235365f6e13fb9f834aa5d" rel="nofollow">https://gist.github.com/joesinghaus/28173990b3235365f6e13fb9f834aa5d</a> */ /* Smaller margins - remove these if you want the huge default left margin */
1733713094
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Good catch Vince! That is indeed the issue.
1733719743
StéphaneD
Pro
Sheet Author
API Scripter
Bingo :) Thanks all for the help. Feeling French for the ranting (which I am) and stupid for the fact that it was in the only few lines I added to pay tribute to the original author of the code (so it’s only half stupidity).