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] Duplicating Roll Button Functionality

1548544028
Finderski
Pro
Sheet Author
Compendium Curator
I have a roll button that does exactly what I want it to and all the styling is how I want it. I have a second roll button that needs different styling, but should do the exact same thing as the first roll button. Is there a way for me to reference the first roll button in the value of the second roll button? I'd prefer to do it this way, if I can--because I'm lazy; I know I can always set up a hidden field that they both reference...just don't want to do that if I don't have to...again--I'm lazy.
1548551690
GiGs
Pro
Sheet Author
API Scripter
I dont believe there is. I think pretty much everyone just copies the value text as many times as needed. Your idea of using a hidden attribute to store the text that is being repeated across multiple button values is interesting. I have never seen anyone do that.
1548554227
Finderski
Pro
Sheet Author
Compendium Curator
GiGs said: I dont believe there is. I think pretty much everyone just copies the value text as many times as needed. Your idea of using a hidden attribute to store the text that is being repeated across multiple button values is interesting. I have never seen anyone do that. I do it in the Savage Worlds Tabbed sheet, but I use multiple hidden values to do it. Here's what one looks like: <button class="sheet-templatebutton" type='roll' name='roll_tAgilityRoll' title="@{tAgilityRoll}" value='@{skillrt} @{defsTemplate} @{rolltAgility}'></button> <input class="sheet-buttonbox" type="checkbox" name="attr_skillrt" value="0" style="display:none;" /> <input type="checkbox" class="sheet-rt sheet-rt1" name="attr_skillrt" value="&{template:solidtrait}"  data-i18n-title="solid-trait-layout" title="Solid Trait Layout" checked /> <input type="hidden" name="attr_defsTemplate" value="&{template:solidtrait}" /> <input type='hidden' name='attr_rolltAgility' value='{{name=@{character_name}}} {{skill_name=^{agility}}} {{skill_rank=@{Agility}}} {{skill_rank_mod=@{agMod}}} {{att_mod=[[@{agrollMod}]]}} {{ttmod=[[@{ttmod}]]}} {{enc=[[@{encumbrance}]]}} {{wounds= [[@{woundsMod}*-1]]}} {{fatigue= [[@{fatigue}*-1]]}} {{skill_roll=[[1d@{agility}! + @{agMod} + @{agrollMod}[Skill Modifier] + @{ModSumEnc}[Other Modifiers]]]}} {{wild_die_rank=@{wilddie}}} {{mook=[[1d0+@{wdNum}]]}} {{mook=[[1d0+@{wdNum}]]}} {{wild_die=[[[[@{wdNum}]]d@{wilddie}! + @{agMod} + @{agrollMod}[Skill Modifier] + @{ModSumEnc}[Other Modifiers]]]}}' /> The skillet field lets me set a roll template in the configuration section, and if one isn't set, then it'll use the default template (defsTemplate).  That bit will be disappearing in the re-write, but I'm still using hidden fields to store the roll formula to make it easier to modify if necessary. I'll just need to create a hidden field that aggregates the multiples into a single field...I like having one place to modify things so things don't get missed.  Oh well...I was afraid that was the answer. Thanks.
1548556163
GiGs
Pro
Sheet Author
API Scripter
I just realised I use the same method for setting the sheet's rolltemplate (it's a dropdown selector, and the value is the template).  Your post did remind me how I wished roll20 had a templating system for button rolls. Most rolls are the same, with just the attribute calls differing, so it would be great to be able to store a roll template (heh, as opposed to a rolltemplate), and be able to enter things like value="roll:skill,  att1:dex ,  att2:acrobatics"  or value="roll(skill,dex,acrobatics)" and have the sheet construct the rolls as needed.
1548556308
Finderski
Pro
Sheet Author
Compendium Curator
GiGs said: I just realised I use the same method for setting the sheet's rolltemplate (it's a dropdown selector, and the value is the template).  Your post did remind me how I wished roll20 had a templating system for button rolls. Most rolls are the same, with just the attribute calls differing, so it would be great to be able to store a roll template (heh, as opposed to a rolltemplate), and be able to enter things like value="roll:skill,  att1:dex ,  att2:acrobatics"  or value="roll(skill,dex,acrobatics)" and have the sheet construct the rolls as needed. That would be cool!
1548557997
GiGs
Pro
Sheet Author
API Scripter
For reference this the rolltemplate code i used: value='&{template:KAP-@{roll_template}} {[rest of button stripped for clarity}}' with the config selector looking like this:                 <select name="attr_roll_template" class="sheet-long" > <option value="prose" selected>Prose</option> <option value="scroll">Scroll</option> </select>