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 Macro & table

December 22 (8 years ago)
Im trying to do a basic table for skills. Just to say the players name {character}, The skill being rolled{acrobatics} and the result{roll}. I looked all over im just having trouble understanding the code if anyone could please help.



&{template:skill} {{character=[[@{character}]]}} {{name=[[{Acrobatics}]]}} {{roll=[[1d20+[[@{Acrobaticstotal}]]]]}}

<rolltemplate>
<table>
<tr><th>Skill</th></tr>
<tr><td><span>Name: </span>{{character}}</td></tr>
<tr><td><span>Skill: </span>{{name}}</td></tr>
<tr><td><span>Roll: </span>{{roll}}</td></tr>
<tr><td><span><div></div></td></tr>
</table>
</rolltemplate>
December 22 (8 years ago)
In my knowledge the top line you posted (&{template:skill} {{character=[[@{character}]]}} {{name=[[{Acrobatics}]]}} {{roll=[[1d20+[[@{Acrobaticstotal}]]]]}} Should be more than suitable.

Are you trying to get the above macro to fit into that table?
December 22 (8 years ago)
Yes
December 22 (8 years ago)
When i use the roll button it just says 1 in chat though
December 22 (8 years ago)

Edited December 22 (8 years ago)
vÍnce
Pro
Sheet Author
Are you editing your character sheet's html and css (using a custom sheet) or are you just wanting to make a skill macro based of an existing character sheet, and if so which sheet are you using?  

You can use a table layout as you wish, but you have to actually modify the roll templates html/css on the character sheet. (wiki: Roll Templates)

If all you want is to make a skill macro using an existing roll template from a sheet, AFAIK, you cannot insert html/css inside a macro or within a roll template as per your example.  You can use some basic formatting using markdown.(wiki:Basic Formatting).  When using an existing roll template, your layout, formatting, limited roll logic, etc. are determined by the sheet authors coding.
December 22 (8 years ago)
I made my own sheet using HTML/css. It went really well until I got to roll templates and button macros.
December 22 (8 years ago)
Brian helped me out a bit. He said my character and name don't need to be inline rolls. Any other advice our tricks would be awesome though. Thanks Vince
December 22 (8 years ago)
vÍnce
Pro
Sheet Author
Robert,
my suggestion is to re-read the Roll template section on the wiki(lot's of helpful info there), update your code with your new-found roll template knowledge and then post back with a sample of your code and any questions.
December 22 (8 years ago)
Thanks man I appreciate it and will do.
December 22 (8 years ago)
Great community love this site
December 23 (8 years ago)
Got it.

<tr>
<td><input type="text" name="attr_Acrobaticsread" value="Acrobatics" style="width:50%" readonly /></td>
<td><input type="number" name="attr_Acrobaticstotal" value="@{Acrobatics}+@{Reflextotal}" disabled="true"/></td>
<td><input type="number" name="attr_Acrobatics1" value="0"/></td>
<td><button type=rollname="attr_Acrobatics2"value="&{template:skill} {{name=@{character_name}}} {{skillname=Acrobatics}} {{roll=[[1d20+@{Acrobaticstotal}]]}}"/></button></td>
</tr>

<rolltemplate>
<table>
<tr><th>Skill</th></tr>
<tr><td><span>Name: </span>{{name}}</td></tr>
<tr><td><span>Skill: </span>{{skillname}}</td></tr>
<tr><td><span>Roll: </span>{{roll}}</td></tr>
</table>
</rolltemplate>

.sheet-skill_roll {
color: #B5AF08;
font-weight: bold;
text-align:center;
width: 20px;
height: 20px;
margin: 0.0;
padding: 0.0em;
border: none;
border-radius: 5px;
box-shadow: 0 0 5px 3px #B5AF08
background: #f6f6f6;
background: -moz-radial-gradient(#f6f6f6, #dfdfdf);
background: -webkit-radial-gradient(#f6f6f6, #dfdfdf);
background: -ms-radial-gradient(#f6f6f6, #dfdfdf);
background: -o-radial-gradient(#f6f6f6, #dfdfdf);
background: radial-gradient(#B5AF08, #010101);


December 23 (8 years ago)
How do you reference a repeating section in a macro? I saw the thread stating -ABC123 and so on just not sure where i take the value from. Also can you reference a skill in a repeating section?
December 23 (8 years ago)

Edited December 23 (8 years ago)
vÍnce
Pro
Sheet Author
Cool.  I would recommend a few additional things;
  1. Give your roll template a unique name/class to help identify your roll template to roll20 and allow you to create other roll templates.  
  2. Move your roll template code to the end of your html file to keep things organized.
  3. You might want to use some conditional logic in your roll template.  ie you can wrap your property/key and value combos <#foo>Something=<foo></foo>  This would  only display Something=<foo> if three was a value for <foo>.  
  4. allprops() is another nice feature so that any property/key not defined by your roll template can still use the roll templates formatting.  ie someone wants to make a unique roll in their macro using one of your defined roll templates  &{template:skill}{{Uncle Buck's Annoyance Check=[[ 1d20 ]] }}  How could you possibly know someone wanted to use a property/key called "Uncle Buck's Annoyance Check"? 
  5. This info is in the roll template section of the wiki
example 
<!-- Roll templates -->
<rolltemplate class="sheet-rolltemplate-skill">
<table>
  <tr><th>Skill</th></tr>
  <#name><tr><td><span>Name: </span>{{name}}</td></tr></name>
  <#skillname><tr><td><span>Skill: </span>{{skillname}}</td></tr></skillname>
  <#roll><tr><td><span>Roll: </span>{{roll}}</td></tr></roll>
</table>
{{#allprops() name skillname roll }}
        <tr><td>{{key}} = {{value}}</td></tr>
{{/allprops() name skillname roll }}
</rolltemplate>
You can pull repeating attribute data by using the fieldsets unique name.  
Make sure to name your fieldsets using class="repeating_X"
<fieldset class="repeating_skills"> 
  My Foo:<input type="number" name="attr_foo" value="0" />
</fieldset>
Using repeating attribute data within a fieldset only requires the name of the attribute.  For example if you wanted to add attributes together that were with the same fieldset  ie
<input type="number" name="attr_foo3" value="(@{foo}+@(foo2))" disabled />

To grab attribute data that resides within the fieldset use something like
@{selected|repeating_skills_$X_foo}  where X represents the row number of the repeating row(starts at "0" for the first row btw) or you can substitute "$X" for the repeating row's unique id.  There are ways to post this within the character sheet(another tutorial required) or you can use your browser inspect element feature to view the code associated with that particular repeating row.  Using id's are handy since regardless of how someone may rearrange their repeating rows using roll20's built-in modify feature, you can target a particular repeating attribute 100% of the time.

Hope this helps.
Cheers
December 26 (8 years ago)
Say I used the repeating section to list the weapon skill to be rolled upon. But I only wanted one macro/roll button. Then depending on what my player selected from the repeating field it would roll accordingly. Can i call an attribute for a repeating section value you and then reference that value you depending on the players selected weapon type in a roll button?
 
<h3>repeating_Weapons</h3>
<fieldset>
<select name="attr_wtype">
<option value="@{MeleeWeapontotal}">Melee Weapon</option>
<option value="@{HeavyMeleetotal}">HeavyMelee</option>
<option value="@{FinesseWeapontotal}">FinesseWeapon</option>
<option value="@{Throwntotal}">Thrown</option>
<option value="@{HandtoHandtotal}">HandtoHand</option>
</select>
</fieldset>
<tr><td><button type=rollname="roll_Attack"value="/roll 1d20+@{repeating_Weapons_$?_attributename}"/></button></td>

I have several weapon types some use Dex as the base attribute some use STR

December 26 (8 years ago)
Wow why did it have to be so simple :/
<h3>Weapons</h3>
<fieldset>
<select name="attr_wtype">
<option value="@{MeleeWeapontotal}">MeleeWeapon</option>
<option value="@{HeavyMeleetotal}">HeavyMelee</option>
<option value="@{FinesseWeapontotal}">FinesseWeapon</option>
<option value="@{Throwntotal}">Thrown</option>
<option value="@{HandtoHandtotal}">HandtoHand</option>
</select>
<td><button type=rollname="roll_Attack"value="/roll 1d20+@{wtype}"/></button></td>
</fieldset>