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 with Ability Command Buttons and Elements from Repeating Sections

I am trying to build an Ability Command Button (ACB) menu for my custom D&D 3.5 sheet. For elements like Saving Throws, Skill Checks, and Ability Checks (with finite, defined lists), it's working great. Now I am trying to generate ACBs for items in repeating sections like Attacks, Spells, and Special Abilities, and I cannot get them to work, not even building them manually in chat. I get the ACBs to display fine, but they don't execute properly. Here is an example as my best guess at this point, though I know this does not work: [Longsword](~-Kjie5flFsUNTrf-PfBh|repeating_meleeweapons_-kjk6r9vj4wo0uqzzbwx_mwpn_fullattackmacro) Where -Kjie5flFsUNTrf-PfBh is the character_id and -kjk6r9vj4wo0uqzzbwx is the repeating section row ID for the Longsword. This generates the following error: No ability was found for %{-Kjie5flFsUNTrf-PfBh|repeating_meleeweapons_mwpn_fullattackmacro} Can someone confirm the syntax for repeating section elements in ACBs? Thanks for any and all assistance!
So, what you want is %{repeating_<repeating section name>_$<number of the row you are trying to pull from>_<name of ability or attribute>} How that translates to what you are using I'm not sure... I usually just type it out as such example: %{repeating_customrogue_$3_crnoarmor}    < from the updates to the AD&D 2E sheet to pull the No Armor roll from a custom rogue skill in said repeating section, row 4 (first row is always 0)
1500467506

Edited 1500467533
Thanks for the answers, SFX. I had not tried the repeating section's order number; I thought it was recommended not to use those as they could change with dragging and dropping within a repeating section. Now I have tried it and I get practically the same result. Looking at your sheet now. I do not see a button to generate an ACB menu in chat. Did I miss it? To be clear I want to generate something like the following in chat:
Ahh, no, my sheets don't have that capability yet. My understanding of HTML, CSS and even JavaScript is extremely limited. I'm mostly just good at finding patterns and changing them slightly :) And yeah, using the $# will result in changing things if they ever get moved at all. But, I have have no idea how to pull those I D numbers you were using. @Silvyre @The Aaron @Brian You guys know this stuff! I'm just trying to be helpful and failing at it :D
1500487450
The Aaron
Pro
API Scripter
In Chrome, if you right click somewhere in a Repeating Row and inspect, you can search for the RowId in the HTML that contains it. Then you just swap out the $# for that id.
Thanks to you both. I can get the Row ID or the Row $X number, no problem. But neither one seems to work in building an Ability Command Button. That's my issue.
1500495346

Edited 1500495386
The Aaron
Pro
API Scripter
Try: [Longsword](~@{character_name}|repeating_meleeweapons_-kjk6r9vj4wo0uqzzbwx_mwpn_fullattackmacro)
1500498646
Jakob
Sheet Author
API Scripter
It actually works with id as well as name.
Thanks again TheAaron and you too, Jakob, but I must be doing something wrong, as this syntax does not execute, giving a "TypeError: d is undefined" error. I tried with both character_name and character_id with the same results.
1500516092
The Aaron
Pro
API Scripter
Does that happen when you click the button or when you send the button to chat? 
Sorry I was not clear: when I paste the command in chat the button does not render, and the TypeError message appears. I edited the command you gave above in Notepad, inserting the character_name and the character_id, before pasting into chat.
1500517612
The Aaron
Pro
API Scripter
I feel like I've run across that issue before. I'll try to duplucate it tomorrow. 
Thanks, TheAaron. I appreciate you looking into it.
I have discovered my problem: I am getting the reprowid in a way that changes it to all lowercase, which won't work, of course. I need to find another way to get that that preserves the case. Thanks again for everyone who replied!
1501507444
The Aaron
Pro
API Scripter
Oh wow!  How'd you ever figure that out???
By doing what I should have done to begin with: starting at basic troubleshooting. I knew the attack buttons in my sheet work, but not the ones in my ACBs. When I dragged the attack button on the sheet to the macro bar to see how it was formed, the problem was obvious. Anyone have an easy way for a sheetworker to get the reprowid and preserve case?
1501543831
The Aaron
Pro
API Scripter
<a href="https://wiki.roll20.net/Sheet_Worker_Scripts#getSe" rel="nofollow">https://wiki.roll20.net/Sheet_Worker_Scripts#getSe</a>... getSectionIDs doesn't preserve case? &nbsp;That's actually starting to sound familiar...
Now I don't think this was the cause. Looking at the Pathfinder sheet I see their ACB menu uses the all lowercase reprowid as well, but the buttons work fine all the same. If getSectionIDs is the only way to get the reprowid, and getSectionIDs makes everything lowercase, then it must be something else I am doing or not doing, since it works on other sheets.&nbsp;
1501896752

Edited 1501897082
I have set up a new game with a nearly-minimal test case and still cannot build working ACB menus nfor repeating elements. &gt;:-( I did find in my testing that manually making an ACB using the character's name instead of the character_id in the following syntax works with the lowercase repeating section IDs: [Label](~character_name|repeating_melee_RowIDInLowerCase_melee_roll) So now I am trying to build that in my sheet worker code, but I am clearly mangling something here: var updateMeleeAttacks = function updateMeleeAttacks(){ &nbsp;&nbsp;&nbsp; getAttrs(["character_name"], function(values) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var char_name = (values["character_name"]); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; console.log(char_name+'============================='); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TAS.repeating('melee') &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .attrs('melee_attacks') &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .fields('melee_name','melee_id','melee_roll') &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .reduce(function(m,r){ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m.desc.push('['+r.melee_name+'](~'+char_name+'|repeating_melee_'+r.melee_id+'_melee_roll)'); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return m; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },{desc:[]},function(m,r,a){ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a.melee_attacks=m.desc.join(' '); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .execute(); &nbsp;&nbsp;&nbsp; });&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }; I see char_name reported out in the console log, but it does not seem to proceed from there. Any further help appreciated.
1502108845
The Aaron
Pro
API Scripter
Do you see anything if you log inside the reduce?