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

Referencing Attributes that are Sums of other Attributes in Macros

So there is likely a simple solution to this, but I'm currently working on modifying the Vaults and Deathclaws character sheet, setting up custom roll templates and so on. I've run into an issue in which the macro is referencing an attribute that is, itself, the sum of two other attributes.  Case in point: <button type="roll" class="sheet-skill_button" name="attr_strength_roll" value="&{template:stat} {{char-name=@{character_name}}} {{stat-name=Strength}} {{roll=[[@{strength}[Base]] + [[?{SPECIAL Mod|0}[Mod]] - [[1d10[Roll]]]]}}"></button>  <input type="number" class="sheet-number" name="attr_strength" value='@{strength_mod} + @{strength_base}' disabled="true"/>  When the macro is displayed in chat, what should be the value of sum of strength_mod and strength_base is instead is instead the equation. Something like: Player(character_name) Strength(stat-name) [[0 + 8[Base]] + [[0[Mod]] - 2] My workaround from then on out was to just have those two attributes be summed up in the macro itself: &{template:special} {{char-name=@{character_name}}} {{stat-name=Strength}} {{stat-value=[[@{strength_mod} + @{strength_base}]]}} {{roll=[[1d10 - ?{SPECIAL Mod|0}]]}} It wasn't ideal, but it worked well enough as I was going through the rolls for the Stats. now that I've arrived at the Skill Checks, which by default look something like this: <button class="sheet-skill_button" type='roll' name="attr_roll-archery" value="&{template:default} {{name=@{character_name}}} {{Archery=[[[[@{archery}]] + [[?{Skill Mod|0}]] - [[1d100]] ]]}}" /></button> <!--- Few more lines of code ---!> <input type="number" class="sheet-number" name="attr_archery" value="(@{strength_base} + @{perception_base} + @{agility_base} + @{luck_base} + 20*@{tagskill31} + @{temp-archery} + @{mod-archery})" disabled="true"/> It's looking like I'm going to have to do the same thing again, but this time having the macro include all of the (@{strength_base} onward, and for all 30+ skills. All of that is to say, I am a novice in every respect, so I defer to all of you who know a great deal more than me in this.  Is there a way to make the attribute, as in @{strength} reference the sum of the calculation in its value without the output in the chat being the equation itself?
1701324551

Edited 1701328713
GiGs
Pro
Sheet Author
API Scripter
Oneiris H. said: All of that is to say, I am a novice in every respect, so I defer to all of you who know a great deal more than me in this.&nbsp; Is there a way to make the attribute, as in @{strength} reference the sum of the calculation in its value without the output in the chat being the equation itself? It should be doing that already. When it's doing that, it means that one of the attributes isn't being treated as a number. You can try to fix this by putting parentheses around each calculation, like this &lt;input type="number" class="sheet-number" name="attr_strength" value='(@{strength_mod}) + (@{strength_base})' disabled="true"/&gt;&amp;nbsp; See if that fixes it. By the way, there's a second method of including calculations, called sheet workers. They are more complex initially, but more powerful and flexible. You can learn about sheet workers (and more) over here: <a href="https://cybersphere.me/roll20-sheet-author-master-list/" rel="nofollow">https://cybersphere.me/roll20-sheet-author-master-list/</a>
1701325305

Edited 1701327151
First, thank you! that fixed it immediately, and frankly it should have been obvious on my end... You're the best1 Second, thank you in general! From the start of my first go at custom sheet making this year to attempting to try it again now your guides and responses in forum posts have been absolutely key to making any progress! (apologies for being so candid, it's just poignant that you responded because today alone I've been going over and over through your guides and such a lot!)
1701328675
GiGs
Pro
Sheet Author
API Scripter
wow, thank you. that's great to hear! And I'm glad that fixed it :)