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 Template Tricks

March 27 (10 years ago)
Toby
Pro
I have been trying to figure out roll templates for the last week. I am slowly beginning to get it, and understand how things work but its not easy. I've learned more from looking at examples on github and from Diana's guide that is built into her character sheet than I have from the Wiki guide that r20 offers. (Its not very detailed in how to do things yet. Perhaps once people figure things out it will be updated.)

That is why I thought I'd create this thread for sharing generic tips and tricks for doing cool effects with roll templates. I am hoping that this starts something interesting where we can share ideas about how to create better and more interesting output and display.

If I have created this in the wrong place or if someone [higher up] thinks I shouldnt have created this, I apologize. Anyways, without further adieu..
March 27 (10 years ago)

Edited March 27 (10 years ago)
Toby
Pro
Sometimes you have a roll that you simply don't want the players to have access to, or you want to hide for Ascetic reasons. For example, a Spell Failure Check.. You dont really need to have a [0] or [1], while adding text based on the output isn't all that hard. Making it so the players cannot see the roll with a mouseover is not possible (that I know of).

However, what is possible is adjusting the position of text so that it is on top of (z-index) and takes the same space as the roll. Doing so you cover the roll entirely so neither the number is visible nor can anyone mouse over it.

The code below is using the pathfinder (necros) as a base but can be adapted to match any. The basic code can be adapted to be used with attack rolls, spell sheets. Especially useful for using spells vs npcs where the player shouldnt know or be able to "find out" what the statistic of the npc are.

<rolltemplate class="sheet-rolltemplate-pf_splcheck">
    <div class="sheet-wrapper" style="background:url(http://i.imgur.com/BLb0XMU.jpg) top left repeat;">
        <div class="sheet-header_background"><div class="sheet-header">{{name}} Spell Failure</div></div>
        <div class="sheet-border">
            {{#spell_fail}}<div class="sheet-content"><span class="tcat">Spell Fail Chance:</span> {{spell_fail}}</div>{{/spell_fail}}
            {{#spell_chk}}
                    <div class="sheet-content"><span class="tcat">Result:</span> {{spell_chk}} 
                        {{#rollTotal() spell_chk 1}} <span class="hroll">{{succeedcheck}}</span> {{/rollTotal() spell_chk 1}}
                        {{#rollTotal() spell_chk 0}} <span class="hroll">{{failcheck}}</span> {{/rollTotal() spell_chk 0}}
                    </div>
            {{/spell_chk}}
        </div>
    </div>
</rolltemplate>
And the CSS:
/* Supress Success/Fail rolls */
.sheet-rolltemplate-pf_splcheck .sheet-hroll {
    background:url(http://i.imgur.com/BLb0XMU.jpg) top left repeat;
    position: relative;
    left: -1.6em;
    z-index: 100;
    font-weight: normal;
}
It looks like this:



The HTML <input> button code
<button class="sheet-text-button" type="roll" title="Spell-Fail-Check" name="roll_Spell-Fail-Check" value="&{template:pf_splcheck} {{name=@{character_name}'s}} {{check=spell fail check}} {{spell_fail=[[@{arcanespellfailure}]]%}} {{spell_chk=[[{1d100}>@{arcanespellfailure}]] }} {{succeedcheck=Success!}}  {{failcheck=Failure!}}">Spell<br>Fail</button>
March 28 (10 years ago)

Edited April 08 (10 years ago)
Coal Powered Puppet
Pro
Sheet Author
That is neat. I'll have to see if there is a way to use that in my sheets.
April 08 (10 years ago)
Toby
Pro
Using a similar technique of success/fail as above I've created a roll template that will allow you to put all of a character's attacks in the same roll template and have it only show the correct number of attacks for his current base attack bonus. The way this is currently designed makes it work with any system that has a base attack bonus that uses the formula of: +1 atk per xx base attack. I don't think it will work with fate or compound success or fail systems but I dont see any reason why the code cannot be adapted with a little tweaking.

Keep in mind it isn't finished and does not calculate confirm and crit damage for all attacks yet and I haven't set this up to look pretty with tables and spans. I'll update the code once I get it perfected if people want me to but the basic functions are here. Also, this DOES NOT play nice with 3d dice, as all rolls in a roll template are in fact rolled even if they are not displayed in the chat. So using this you'll end up with entire bag full of dice being dumped on the table a the same time.

CSS Code required:

.sheet-rolltemplate-35AdvAttack .sheet-wrapper {
    background:url(http://i.imgur.com/BLb0XMU.jpg) top left repeat;
}
.sheet-rolltemplate-35AdvAttack table {
    width: 100%;
    padding: 2px;
}
.sheet-rolltemplate-35AdvAttack .sheet-border {
    border-color: #7E2D40;
    border-style: solid;
    border-width: 1px;
    border-radius: 5px;
}
.sheet-rolltemplate-35AdvAttack th {
    color: rgb(126, 45, 64);
    padding-left: 5px;
    line-height: 1.6em;
    font-size: 1.2em;
    text-align: left;
    font-family:"Times New Roman", Times, serif;
    font-variant: small-caps;
}
.sheet-rolltemplate-35AdvAttack .sheet-subheader {
    color: #000;
    font-size: 1em;
    font-style: italic;
}
.sheet-rolltemplate-35AdvAttack .sheet-arrow-right {
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    border-left: 180px solid rgb(126, 45, 64);
}
.sheet-rolltemplate-35AdvAttack .sheet-tcat {
    font-style: italic;
}
.sheet-rolltemplate-35AdvAttack td {
    padding-left: 5px;
}
.sheet-rolltemplate-35AdvAttack .inlinerollresult {
    background-color: transparent;
    border: none;
}
.sheet-rolltemplate-35AdvAttack .inlinerollresult.fullcrit {
    background-color: transparent;
    color: #3FB315;
    border: none;
}
.sheet-rolltemplate-35AdvAttack .inlinerollresult.fullfail {
    background-color: transparent;
    color: #B31515;
    border: none;
}
.sheet-rolltemplate-35AdvAttack .inlinerollresult.importantroll {
    background-color: transparent;
    color: #4A57ED;
    border: none;
}

HTML Required:

<rolltemplate class="sheet-rolltemplate-35AdvAttack">
<div class="sheet-wrapper">
<div class="sheet-border">
    <table>
        <tr><th>{{name}}</th></tr>
        <tr><td class="subheader">{{subtags}}</td></tr>
        <tr class="arrow-container"><td><div class="arrow-right"></div></td></tr>
<!-- Does not seem to hide this table row like it should... need to fix -->
<!-- Hidden table row holds base attack bonus for each successive attack for the template to check against -->
        <tr style="display: hidden">{{bab_1}} {{bab_2}} {{bab_3}} {{bab_4}}</tr>
        <tr class="rowcolor"> 
            <td><span class="tcat">Atk: </span>{{atk1}}a {{#rollTotal() bab_2 1}}/
                                                {{atk2}}b{{/rollTotal() bab_2 1}} {{#rollTotal() bab_3 1}}
                                               /{{atk3}}c{{/rollTotal() bab_3 1}} {{#rollTotal() bab_4 1}}
                                               /{{atk4}}d {{/rollTotal() bab_4 1}} vs AC</td>
        </tr>
        <tr>
            {{#dmg1}}
                <td><span class="tcat">Dam: </span>{{dmg1}}a {{#rollTotal() bab_2 1}}/
                                                    {{dmg2}}b{{/rollTotal() bab_2 1}} {{#rollTotal() bab_3 1}}/
                                                    {{dmg3}}c {{/rollTotal() bab_3 1}} {{#rollTotal() bab_4 1}}/
                                                    {{dmg4}}d {{/rollTotal() bab_4 1}}</td>
            {{/dmg1}}
        </tr>{{#rollWasCrit() atk1}}
        <tr>
            <td><span class="tcat">Confirm: </span>{{confirm}} vs AC</td>
        </tr>
        <tr>
            <td><span class="tcat">Crit: </span>{{dmgcrit}}</td>
        </tr>
            {{/rollWasCrit() atk1}}
            {{#notes}}
        <tr>
            <td><span class="tcat">Notes: </span>{{notes}}</td>
        </tr>
            {{/notes}}
            {{#attk-notes}}
        <tr>
            <td><span class="tcat">Attack Notes: </span>{{attk-notes}}</td>
        </tr>
            {{/attk-notes}}
    </table>
</div>
</div>
</rolltemplate>

Roll Template code for the macro or button:

&{template:35AdvAttack} {{name=+@{weapon1enh} @{weapon1name}}} {{subtags=@{weapon1type}, @{weapon1specialproperties}}} {{bab_1=1}} {{bab_2=[[{d0+@{bab2}}>1]]}} {{bab_3=[[{d0+@{bab3}}>1]]}} {{bab_4=[[{d0+@{bab4}}>1]] }} {{atk1=[[1d20cs>@{weapon1critmin}+@{wep1hit}]]}} {{atk2=[[1d20cs>@{weapon1critmin}+@{wep1hit}-5]]}} {{atk3=[[1d20cs>@{weapon1critmin}+@{wep1hit}-10]]}} {{atk4=[[1d20cs>@{weapon1critmin}+@{wep1hit}-15]]}} {{dmg1=[[@{weapon1damage}]]}}{{dmg2=[[@{weapon1damage}]]}} {{dmg3=[[@{weapon1damage}]]}} {{dmg4=[[@{weapon1damage}]]}} {{confirm=[[@{weapon1attackcalc}]]}} {{dmgcrit=[[@{weapon1damage}*@{weapon1critmult}]]}} {{type=[@{weapon1type}]}}
This roll template is designed to work with my template, but should work with the 3.5 template with very little tweaking.
{{name}} : Contains the Weapon Enh bonus and weapon name
{{subtags}} : Contains weapon type [B/P/S] and special properties such as keen, fiery, holy etc
{[bab_1}} Always equals 1 because no matter what your initial base attack is (even a negative) you still have one attack.
{{bab_2-4}} Contains the compare check for your second base attack which must be defined on your character sheet.
{{atk1-4}} Contains the roll macro for damage, I have this defined on the character sheet to shorten the roll template size, but you can include everything. the 1d20cf<xx>cs should ALWAYS be in the roll template, dont ask why, it just seems to work best that way. Keep in mind that this is also where you put the negative for each successive attack past the first, normally -5 cumulative. This could easily be modified though to handle class/race modifiers such as flurry of blows or Rapidshot/Multishot. Of course you'd also need to worry about how long each line is in the roll template.
{{dmg1-4}} Include the damage macro here, if you are doing all attacks on one row there wont be any room for anything else.

{{confirm}}, {{dmgcrit}} and {{type}} are not finished for this but the but the general theory holds for creating a show hide for them as well.

WARNING: If you have complicated formula to calculate your base attack, this will produce a javascript error and lock up your screen, I tried using this with auto-calc for 5 levels. each having Good/Average/Poor selection input and multiplying that by the number of levels in that class. It gave my browser a heart attack and it died. I spent almost a week trying to fix it. So just have static number or text fields for base attack, as many classes as you want, but it doesnt work with auto-calcs.

End Result:

Granted, the tables arn't set up and it doesn't look neat and pretty, but it is functional and it does work.

April 08 (10 years ago)
vÍnce
Pro
Sheet Author
Thanks for sharing Toby. I'm sure I'll use some of your technique when modifying character sheets. You really should add this to the wiki. Good stuff.
April 08 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
A forum isn't necessaily the best place to store these kind of things to be accessed by others. I agree that you should add them to the wiki.
April 08 (10 years ago)
Toby
Pro

Mark said:

A forum isn't necessaily the best place to store these kind of things to be accessed by others. I agree that you should add them to the wiki.


1) I was under the impression that the wiki was for official content.
2) I have no idea how to do wiki code even I wanted.
3) I feel that this is more user to user, much like the CSS Wizardry Form.

If I am mistaken I will look into another place to put this.
April 09 (10 years ago)
vÍnce
Pro
Sheet Author

Toby said:

Mark said:

A forum isn't necessaily the best place to store these kind of things to be accessed by others. I agree that you should add them to the wiki.


1) I was under the impression that the wiki was for official content.
2) I have no idea how to do wiki code even I wanted.
3) I feel that this is more user to user, much like the CSS Wizardry Form.

If I am mistaken I will look into another place to put this.

Keep it coming any way you want to share it Toby. I think what Mark meant(correct me if I'm mistaken) is that due to the nature of the forums, it's very easy for great posts, such is this gem, to easily become buried, forever lost in the forum's bottomless, lifeless, backlog...

There are some, "official" pages on the wiki, but the idea of the wiki is that anyone can contribute to it. It's a great repository of shared knowledge. Easily, half the questions on these forums can be answered with a quick search of the wiki.

As far as editing the wiki. It uses a simple markup-based formatting. https://www.mediawiki.org/wiki/Help:Formatting
I started making corrections/additions to the wiki just by hitting the "edit" button on a page and following the same format that was already being used. Monkey see, monkey do.

Please consider the wiki as a viable alternative to the forum.

Thanks again for contributing.

April 09 (10 years ago)
Kryx
Pro
Sheet Author
API Scripter
Exactly what Vince said. :)
April 09 (10 years ago)
Ziechael
Forum Champion
Sheet Author
API Scripter
The wiki also has a helpful and appropriately named 'help' section when you are in edit mode. This little gem gives you all the formatting help you'll need to produce a beautifully laid out masterpiece.

As Vince says, this information is too good to lose in the bowels of the forum one day, wiki it and then mods like me get to link people to it whenever questions about these sort of things crop up :)
April 09 (10 years ago)
Toby
Pro
Thank you all, I will continue to post here until I have the time to glance at the wiki and perhaps put it into the wiki (Which, I intended in some way to do anyways, sorta). My attention now is on constructing a tabbed version of the 3.5 sheet. That is taking 90% of my time and energy. Once that is done, I will of course move onto a wiki.

I really did believe they were for use mostly by the staff, now that I know they aren't will be making good use of it, and maybe fixing some entries, which don't explain things very well.

Thank you for the feed back, please feel free to use this thread as well for tips and tricks with roll templates, anything here I will add to the wiki page when I do make it.
April 09 (10 years ago)
vÍnce
Pro
Sheet Author
I love happy endings. :-) Cheers
April 09 (10 years ago)

Edited April 09 (10 years ago)
Toby
Pro
Unfortunately, I dont have a happy ending for this. This method worked for about 3 hours with no delay from click, I then went to bed, woke up and started to troubleshoot other areas.. and noticed a significant delay from macro button click and chat display. it is anywhere between 9-14 seconds.. I do not have the technical skill to troubleshoot this to determine the cause of this leak

It works fine as written above (i think), but when prettied up and put into table with confirm and damage things fall apart. I need to try and find a way to make this work. Of every time saving tool, this is the one I'd sacrifice everything else for. The amount of time this will save on adjusting macros based on number of attacks is enormous. Especially for DM's like me who create fully every npc in the way many create players.

I created this to solve these key issues:
1) Save time when an npc or player gains bab for new attack.
2) Display all the attacks based from a a given weapon in a line in a more compact manner than a single attack per macro.
3) To avoid using API because of the limitation of who can use them and the inability to use them built-in to character sheets.

Not sure yet how to correct this, but it looks like significant delays and time wasted. If anyone has thoughts please let me know. I'd love to hear them.
April 09 (10 years ago)

Edited April 09 (10 years ago)
Toby
Pro
An update to above ^^ Apparently the dev server force each roll to be calculated sequentially now because of NESTED inline rolls, I hope this is fixed because it will make my games unplayable. Especially if you cant have more than one or two rolls in a single macro to keep them from taking 3-5 seconds to run... Let alone having the 12 rolls minimum for this roll template.

*shudder*
April 10 (10 years ago)
vÍnce
Pro
Sheet Author
Typically the newest features on the Dev cause problems, but Riley and the Devs are usually quick to address them.
April 10 (10 years ago)
Toby
Pro
Yep, was just issuing a correction to my previous post.