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

Calling an Attribute inside a Template

i currently have a template im trying to work on and i really not 100% sure if i can do this but   This is what im trying to make but  i haven't been able to figure out how to call an attribute right into the template and maybe i cant even do it but  i have been tinkering around a little bit with it but cant wrap my head around it  how to do it or even it it is possiable
1570887596
GiGs
Pro
Sheet Author
API Scripter
It's always best to post the code you have, it's a lot easier to suggest fixes. That said, you can't call an attribute from inside a rolltemplate. A rolltemplate is used to present information only, you need to pass the attribute value to it as one of the rolltemplate parameters. It'd be a lot easier to illustrate what I mean if you posted your code, and also an example macro that uses the template.
1570887793

Edited 1570888135
<rolltemplate class="sheet-rolltemplate-DMG"> <table>     <tr>       <th>{{name}}</th>     </tr>     <tr class="arrow-container">       <td>         <div class="arrow-right"></div>       </td>     </tr>     <td>       <div class="left" style="width: 70px;"><span>Energy </span>[[1d4]]</div>       <div class="left" style="width: 40px;">Ion<br></div>       <div class="left" style="width: 70px;">Sonic<br></div>       </td>       <td class= "layer">       <div><input class="sheet-inputbox" type="text"  value="@{resistenergy}"   style=" width: 65px;" disabled="true"></div>       <div><input class="sheet-inputbox" type="text"  value="@{resistion}"      style=" width: 35px;" disabled="true"></div>       <div><input class="sheet-inputbox" type="text"  value="@{resistsonic}"     style=" width: 65px;" disabled="true"></div>       </td>       <td>       <div class="left" style="width: 40px;">Elec<br></div>       <div class="left" style="width: 45px;">Fire<br></div>       <div class="left" style="width: 40px;">Cold<br></div>       <div class="left" style="width: 40px;">Poison<br></div>     </td>     <td class= "layer">       <div><input class="sheet-inputbox" type="text"  value="@{resistelectric}" style="width: 40px;" disabled="true"></div>       <div><input class="sheet-inputbox" type="text"  value="@{resistfire}"     style=" width: 40px;" disabled="true"></div>       <div><input class="sheet-inputbox" type="text"  value="@{resistcold}"     style=" width: 35px;" disabled="true"></div>       <div><input class="sheet-inputbox" type="text"  value="@{resistpoison}"    style="width: 35px;" disabled="true"></div>     </td>     <td>       <div class="left" style="width: 60px;">Pierce<br></div>       <div class="left" style="width: 60px;">Blunt<br></div>       <div class="left" style="width: 60px;">Slash<br></div>     </td>     <td Class= "layer">       <div><input class="sheet-inputbox" type="text"  value="@{resistpiercing}"  style="width: 55px;" disabled="true"></div>       <div><input class="sheet-inputbox" type="text"  value="@{resistbludgeon}"  style="width: 55px;" disabled="true"></div>       <div><input class="sheet-inputbox" type="text"  value="@{resistslashing}"  style="width: 55px;" disabled="true"></div>     </td>     <td></td>     <tr class="rowcolor">       <td><span>Damage taken: </span>{{Dmg}} {{Dtype}}</td>     </tr>   </table> </rolltemplate>
i know this code doesnt work but it how in my head i was getting somethign to work
1570889612
GiGs
Pro
Sheet Author
API Scripter
You cant use inputs in rolltemplates. All informtion in rolltemplates has to be passed using the {{name= }} method. So if you do want to display all those attributes, you'd need a macro that looks like &{template:DMG} {{name=whatever}} {{DMG=your roll here}} {{electric=@{resistelectric} }} {{fire=@{resistfire} }} {{cold=@{resistcold} }} {{poison=@{reststpoison} }} Then you can use them in your rolltemplate like <td class= "layer">       <div>{{electric}}</div>       <div>{{fire}}</div>       <div>{{cold}}</div>       <div>{{poison}}</div> </td> The fact that your energy entry shows a d4 though makes me curious. If these are dice rolls that are meant to be rolled, you'd need to tweak that macro. This {{electric=@{resistelectric} }} would become {{electric=[[@{resistelectric}]] }} to make sure it as actually rolled when displayed. Hope that helps!
1570889666
GiGs
Pro
Sheet Author
API Scripter
Now having explained that, I have to ask: do you need to include all those resistances? Wouldnt it be better to just display the ones that are relevant?
the energy [[1d4]] was to see if i could test to see if an inline roll would work inside the template and it didnt.  i just hadn't taking it back out  i was kinda afaid that i would have to do that for each on but that was my main question if there was a way to not have to call all these things and to answer ur other question i have all of them there b/c they could take mutiply kinda of damage  so i jsut wanted to have them all up there  to see
1570891580
Andreas J.
Forum Champion
Sheet Author
Translator
Also, how are you testing this if you don't have a Pro subscription? Do you have some who made a test campaign for this? Roll templates are hardcoded into character sheets, and custom character sheets can only be used with a Pro subscription.
i am working on this for a buddy of mine that has a pro account i edit the code and he upload it to this game
1570891942
Andreas J.
Forum Champion
Sheet Author
Translator
Pred Alien said: i am working on this for a buddy of mine that has a pro account i edit the code and he upload it to this game Ah, good to hear. I was starting to fear you where doing all the work & testing outside Roll20. Would have been a rude awakening to notice half the things looking differently when doing actual testing. There have been a few people here and there who have done this, I just wanted to make sure :D
1570899836
Finderski
Pro
Sheet Author
Compendium Curator
Pred Alien said: the energy [[1d4]] was to see if i could test to see if an inline roll would work inside the template and it didnt.  i just hadn't taking it back out  i was kinda afaid that i would have to do that for each on but that was my main question if there was a way to not have to call all these things and to answer ur other question i have all of them there b/c they could take mutiply kinda of damage  so i jsut wanted to have them all up there  to see To build on what GiGs posted, you can also hide things that aren't necessary or things that are optional.  This can be a little tricky as part of a roll button, but...you can do stuff like: <td class= "layer">       {{#electric}}<div>{{electric}}</div>{{/electric}}       {{#rollGreater() fire 0}}<div>{{fire}}</div>{{/rollGreater() fire 0}}       {{#^rollTotal() cold 0}}<div>{{cold}}</div>{{/^rollTotal() cold 0}}       <div>{{poison}}</div> </td> The electric stuff would only be shown if electric was passed in the macro. Fire would only show if the roll was greater than 0. Cold would only show if the total of the roll was not 0. This way if you don't pass certain things or if you are passing everything, but only want it to show if it has relevance, you can add those other qualifiers. You're probably already reading/aware of the wiki page, but there's a lot of great nuance you can get with the additional helper functions and the such.  It still has some major limitations, but you really can get pretty tricky with it.