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

Help Understanding Nested Tables

1595630410
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
First of all, the code works. Second I don't understand how and I need some help here. Hopefully, it will be helpful for others cause I didn't see this feature explained in any wiki or documentation. I am working on fixing someone else table, but they already did an incredible job. I understand in general how the code works (and I've been able to change it) but now why. They created a nested table. In practice you roll for see if the roll succeded, and then you can roll on the damage. The button html <!-- Button you see --> <button class="dicefontd10" name="weapon" type="roll" title="weapon roll" value="@{gm_toggle} &{template:rolls} {{header=@{weapons}}} {{subheader=@{skill_percent}}} {{dice=[[1d100]]}} {{damage=^{damage} [@{damage}](~repeating_weapons_damage)}} {{lethality=^{lethality} [@{lethality}](~repeating_weapons_lethality)}} {{lethality_rating=^{lethality_percent} [@{lethality_percent}](~repeating_weapons_lethality_percent)}}">k</button> <!-- Nested button for both normal and lethal damage --> <button class="none" name="roll_damage" type="roll" value="@{gm_toggle} &{template:damage} {{header=@{weapons}}} {{subheader=@{damage}}} {{damage=[[@{damage}]]}}"></button> <button class="none" name="roll_lethality" type="roll" value="@{gm_toggle} &{template:lethality} {{header=@{weapons}}} {{lethality_rating=@{lethality_percent}}} {{lethality=[[@{lethality}]]}}"></button> The rolltemplate code <!-- Template of the rolls --> <div class="rolltemplates"> <rolltemplate class="sheet-rolltemplate-rolls"> <div class="sheet-template-container">{{#header}} <div class="sheet-template-header"> <h1>{{header}} </h1> <h2>{{#subheader}}({{subheader}}%){{/subheader}}</h2> </div>{{/header}} <div class="sheet-template-body">{{#dice}} <div class="sheet-template-row"><span class="inlinerollresult">{{dice}}</span><span class="percent">%</span></div>{{/dice}} <!-- if damage exists, show the damage button --> {{#damage}} <div class="sheet-template-row"> <span class="inlinerollresult">{{damage}}</span></div>{{/damage}} <!-- if lethality exists, show the lethality button --> {{#lethality_rating}} <div class="sheet-template-row"> <span class="inlinerollresult">{{lethality}}</span></div>{{/lethality_rating}} {{#desc}} <div class="sheet-template-row"><span class="sheet-template-desc">{{desc}}</span></div>{{/desc}} </div> </div> </rolltemplate> </div> <!-- template for damage, I need to make some comparison so it uses a different template <div class="rolltemplates"> <rolltemplate class="sheet-rolltemplate-damage"> <div class="sheet-template-container">{{#header}} <div class="sheet-template-header"> <h1>{{header}} </h1> <h2>{{#subheader}}({{subheader}}){{/subheader}}</h2> </div>{{/header}} <div class="sheet-template-body">{{#dice}} <div class="sheet-template-row"><span class="inlinerollresult">{{dice}}</span><span class="percent">%</span></div>{{/dice}} {{#damage}} <div class="sheet-template-row"> <span class="inlinerollresult">{{damage}}</span></div>{{/damage}} {{#desc}} <div class="sheet-template-row"><span class="sheet-template-desc">{{desc}}</span></div>{{/desc}} </div> </div> </rolltemplate> </div> <!-- template for lethality --> <div class="rolltemplates"> <rolltemplate class="sheet-rolltemplate-lethality"> <div class="sheet-template-container">{{#header}} <div class="sheet-template-header"> <h1>{{header}} </h1> <h2>({{lethality_rating}}%)</h2> </div>{{/header}} <div class="sheet-template-body"> <div class="sheet-template-row"><span class="inlinerollresult">{{lethality}}</span><span class="percent">%</span></div> </div> </div> </rolltemplate> The sheet The output I suspect it has to do with this command in the roll template: {{damage=^{damage} [@{damage}](~repeating_weapons_damage)}} But I never seen it before so I'm not sure what it is supposed to do. In particular 1) what ^{<attribute_name} is supposed to do in this call? 2) do I need the (~repeating_weapons_damage)   in the call? What is it supposed to do 3) notice the single bracket to pass it as a variable to roll instead of a roll 4) Why the other two buttons don't show up? Thanks for the help
1595656015
GiGs
Pro
Sheet Author
API Scripter
Marco M. said: I suspect it has to do with this command in the roll template: {{damage=^{damage} [@{damage}](~repeating_weapons_damage)}} But I never seen it before so I'm not sure what it is supposed to do. In particular 1) what ^{<attribute_name} is supposed to do in this call? 2) do I need the (~repeating_weapons_damage)   in the call? What is it supposed to do 3) notice the single bracket to pass it as a variable to roll instead of a roll 4) Why the other two buttons don't show up? Thanks for the help This syntax:  [something](~ability)  is the format used to print a button to chat. The square brackets contain the label, and the round brackets contain the ability call - what happens when you click the button. Look up Ability Command Buttons in the wiki for more. I think this ^ is for the translation system. It ensure the attribute_name is shown in the players language. ~repeating_weapons_damage is a button trigger. When you press the button labelled damage, that hidden button named damage (shown as "roll_damage"), in the repeating_weapons section, is rolled. The square brackets hold the label that will appear on the button. Here it's just displaying whatever is in the @{damage} attribute. I cant see the full sheet code, but I would guess it is because of this in the button html:  class="none" . There will be a CSS entry sheet-none , which causes any elements with that class to be hidden.
1595662515
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
Wow thanks. That explains a lot  :) Is there a reason why the roll template used is tge one of the hidden buttons? That's the part that messes with my brain the most: it seems than when i press the button with damage it uses the hidden  damage roll and when i press Lethality it uses the lethality one 
1595663339
GiGs
Pro
Sheet Author
API Scripter
I'm not sure what you're asking. In your html you have these two hidden buttons: <button class="none" name="roll_damage" type="roll" value="@{gm_toggle} &{template:damage} {{header=@{weapons}}} {{subheader=@{damage}}} {{damage=[[@{damage}]]}}"></button> <button class="none" name="roll_lethality" type="roll" value="@{gm_toggle} &{template:lethality} {{header=@{weapons}}} {{lethality_rating=@{lethality_percent}}} {{lethality=[[@{lethality}]]}}"></button> The only exist so to provide a roll for those damage and lethality buttons.
1595664349
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
Perfect that was the question. I assumed tgey had to be embedded inside the first rolltemplate itself, i didnt know this was an option. Thanks so much for tge explanation,  it's a neat trick and i wanted to understand how it worked exactly  :)
1595664723
GiGs
Pro
Sheet Author
API Scripter
Great! Ability Command Buttons are a way of running abilities from a character sheet - they can call buttons on the character sheet, if they've been given a name, and also Abilities on the Attributes & Abilities tab. Buttons and Abilities are basically the same thing. So this is technique you can use in rolltemplates, and sheet designers have to create buttons for them (usually hidden), because they cant rely on users manually creating the Ability.
1595704704
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
That's the coolest thing and it should have an entry in the documention cause wow. It's like when i discovered by mistake that charsheet support gif: i was making a heartbeat similar to the first 2 RE, so when you are at low BPM it's slow and green , and increasing BPM makes it first yellow and then red and alway faster (work in progress for Lacuna)
1595704921
GiGs
Pro
Sheet Author
API Scripter
They are in the documentation, under Ability Command Buttons : Ability Command Buttons can be used to call  Abilities  (or  sheet button rolls ) from a clickable button in the Text Chat.  There is a lot of documentation though, and it is just mentioned in passing.
1595707773
Marco M.
KS Backer
Sheet Author
API Scripter
Compendium Curator
Oh yeah, I knew it works on the chat, but I never thought I could do something like this inside a charsheet (in particular the invisible button that calls the template inside the other template, that's the cool part :D
1595711023
GiGs
Pro
Sheet Author
API Scripter
Ah, right. The thing to understand is that anything the character sheet sends to chat is exactly the same as a macro or manual typing. All the sheet does with roll button values is send the text to chat as if you had manually typed it. Rolltemplates include some special formatting, but they are still just chat text.