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 .
×

Using a previously created roll template in a repeating section button.

First of all, I am new to roll 20 and I am not a programmer. Second, I have searched a couple dozen ways to see if there is any mention of what I am trying to do and have not had much luck. I have created a homegrown game, and with it, a character sheet which covers most of what I want to do. I reused code to create pages which can be selected with buttons which cover the main character stats and a skills page.  The skills page creates roll buttons which use 3 variables including a number of dice modifier for attribute, a roll modifier for attribute (separate) and a roll modifier for the skill.  It looks something like this: <button type='roll' name='roll_rangedhandguns' value='&{template:default} {{name=@{character_name}}} {{Ranged Handguns=[[(2 + @{quicknessapt})d6k2 + @{quickness} + @{handguns} + ?{Modifier?|0}]]}}' class="d6-dice"></button><span></span> As all attacks are just skill rolls in the game, the roll buttons get lost in the skills page, so I wanted to create a repeating section which would allow the skill to be picked from a select dropdown then populate a button which would reuse the already created roll without having to go into a large sheetworker to gather the 3 stats all over again for whatever skill and populate a new roll command with that (I have already done something similar to create a temporary roller which allows a selection of non-default attributes to skills and it is moderately lengthy (again, I am not a programmer)).   The question is: Is it possible to reference the above 'roll_rangedhandguns' in another button based on the dropdown selection in a repeating section? I get that I can use that roll in the chat area, but I want to reuse the roll template in another button instead. My initial idea, which works, was to just list all the possible attack rolls on the character main page, but it is inelegant as it populates rolls the character will never use. I figured the repeating section would allow a player to add only the rolls he or she wanted to the main page to simplify things.
1608858387
GiGs
Pro
Sheet Author
API Scripter
This sounds a bit convoluted. This code should be enough to launch an already excisting button: I'm not following why you need a repeating section here. Just have a select that lets people pick from the list of existing buttons, and then a button to click that uses that button. You can access an existing button in a macro with code like this: %{rangedhandguns}  So your dropdown could be something like <select name="atr_buttons">     <option value="No Button Selected" selected>Choose One</option>     <option value="%{rangedhandguns}">Handguns</option> </select> Add lines for each extra button. Having an empty selection at the start is handy to make sure players actually pick one. Then in your button just do <button name="roll_button" value="@{buttons}"></button>
Thank you. I think I was explaining my needs poorly.  I was looking for exactly what you posted.
I must be doing something wrong. I have removed the selection component to test. So I am just putting in a button and choosing a previously created roll. If I use the button line as it is presented, changing the value="@{buttons}" to read value="@{rangedhandguns}" so it looks like this: <button name="roll_button" value="@{rangedhandguns}"></button> It does not actually call the previous button. I see a minimally sized button that does nothing when clicked. I am sorry to bother on this, but I figured by reducing down to the simplest setup it would work, yet it is not. Thanks
1608912513
GiGs
Pro
Sheet Author
API Scripter
that wont work - the code for a button use % not @
Ok, I tried that too with the same result.  I based the code on what you wrote up above.  Either with the @ or the % it is still not calling the button. This time: <button name="roll_button" value="%{rangedhandguns}"></button>
1608923283
GiGs
Pro
Sheet Author
API Scripter
In that last button you dont have a type, type="roll" , which might be causing it to fail. Also giving it the name button , singular, (in name="roll_button") is probably a bad idea, but i dont know if this causes issues.
1608924217
GiGs
Pro
Sheet Author
API Scripter
aha, the issue is that with ability/button calls, you have to supply a character name, something like <button name="roll_button" value="%{bob|rangedhandguns}"></button> or <button name="roll_button" value="%{selected|rangedhandguns}"></button> I know there is a way to solve this issue, but I'm too sleepy to remember it. Hopefully someone spots the issue while I sleep.
Thanks for the help. I'll have to keep at it tomorrow.
For the record. I could never get a button which reused a button. I tried many variants of the lines suggested. Instead I created 2 dropdown selects. One for melee weapons and one for ranged and just called the appropriate skill from the dropdown with a script for each as melee and ranged use different attributes. The button I made used the variable for the skill provided through the script and called the associated attribute stats directly. In the long run it is probably better than my initial plan of a repeating section.  The coding is clunky but it works.
.