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

How to find out RowId of a repeating section?

Hi, I wanted to write a macro for the Sorcerer's sorcery point system, that automatically subtract the sorcery point from your character sheet when you click on it. I'm planning on doing this using the !ammo script I found out that you could do it if you know the Id of the repeating section, but I'm not quite sure how you go about getting the ID for something like this. The repeating section name that my sorcery point is in is called @{repeating_resource_right} and @{repeating_resource_right_max} respectively.
I have the sorcery points in the sheet as a class resource so this is working for me when selecting the token: !ammo @{selected|character_id} class_resource -1
feid said: I have the sorcery points in the sheet as a class resource so this is working for me when selecting the token: !ammo @{selected|character_id} class_resource -1 Oh, I'm a multi Fighter/Sorcerer so I think my class resource is Second Wind ;w;
1585664160
Andreas J.
Forum Champion
Sheet Author
Translator
Repeating section shouldn't have name with underscores , are you sure the it's not @{repeating_resourceright} and @{repeating_resourceright_max}? The wiki link also points out how you can refer to repeating section rows by their index, rather than exact rowID.
Andreas J. said: Repeating section shouldn't have name with underscores , are you sure the it's not @{repeating_resourceright} and @{repeating_resourceright_max}? The wiki link also points out how you can refer to repeating section rows by their index, rather than exact rowID. huh? when I hover my cursor over the resource box it clearly comes up @{repeating_resource_right} and this is generated by charactermancer. I don't think I know how to find out the index either ;-;
If I can remember it right: @{repeating_resource_$0_resource_left} @{repeating_resource_$0_resource_right} @{repeating_resource_$1_resource_left} @{repeating_resource_$1_resource_right} and so forth. If not, I'm sure some of the script-wizards will be here shortly. :D
1585667841
Andreas J.
Forum Champion
Sheet Author
Translator
Yeah this looks sensible.
1585668894

Edited 1585669229
I'm my experience, the _max attributes don't get called properly. The only way I can think of to do this is @{selected|repeating_resource_$1_resource} / @{selected|repeating_resource_$1_resource|max} EDIT: Sorry idk the actual attribute you're trying to use, but the main important thing is using |max parameter instead of _max . Doing this requires using a selected| or target| or CharName| prefix, or else it tries to read the attribute as the name.
Hi Onigensou. Right-click on any element in the row, then select "Inspect Element" from the context menu. You'll get the whole block of HTML for the page, with the table cell or button or whatever you clicked highlighted. Scroll up from there until you see a line like this: <div class="repitem" data-reprowid="-LtbC63a0vfMx4gX-uys"> the data-reprowid is what you're looking for.
Thank you everyone for answering! I manage to did it by using the index method, but I'm sure being able to find rowID will prove useful for me in the future, thank you again! ^ ^ Ah, one more thing but this is a bit extra! I was wondering for features such as Twinned spell where the sorcery point subtracted depends on the spell level, can you write it so that a box pop-up asking you which spell level you want to use it for, and then base on that answer, subtract the value from the sorcery point? I figure I could snatch some macro from a spell with Higher level cast so this is what I got: !ammo @{selected|token_id} repeating_resource_$0_resource_right [?{SpellLevel|cantrip,-1|1,-2|2,-3|3,-4|4,-5|5,-6|6,-7|7,-8|8,-9|9,-10}] sorcery point But !ammo only recognize this as NaN, so I was wondering if this is possible?
1585700258
The Aaron
Roll20 Production Team
API Scripter
You have only once set of [ ] around the value.  You need either none, or two sets to make it an inline roll.  In this case, since it's not a roll, you don't need the [[ ]] at all: !ammo @{selected|token_id} repeating_resource_$0_resource_right ?{SpellLevel|cantrip,-1|1,-2|2,-3|3,-4|4,-5|5,-6|6,-7|7,-8|8,-9|9,-10} sorcery point
The Aaron said: You have only once set of [ ] around the value.  You need either none, or two sets to make it an inline roll.  In this case, since it's not a roll, you don't need the [[ ]] at all: !ammo @{selected|token_id} repeating_resource_$0_resource_right ?{SpellLevel|cantrip,-1|1,-2|2,-3|3,-4|4,-5|5,-6|6,-7|7,-8|8,-9|9,-10} sorcery point Ah! I see! I'm a noob at code as you can see ; 7 ; Thank you once again Aaron!
1585701364
The Aaron
Roll20 Production Team
API Scripter
No worries, everyone starts there!  Ask lots of questions, get lots of answers, level up!
1585706915

Edited 1585707875
Thank you, I was a bit nervous if I'm bothering people with their time, but I thought if I never ask I'll never know! Then there's a bit more I want to brush up on this macro, trust me I didn't intend for it to get this complicate, but now that I'm able to accomplish the first part more ideas to brush up the macros keep popping up, but I think this'll be the last, since I don't think a Metamagic macro needs anything more. So now I can automatically subtract Sorcery points using !ammo, but I'm still not sure how to added the correct 'Spell Slots' in correspondence to how many Sorcery Point I spent to create a spell slot. I try using the choice query two times, but it seems to only take the answer from one, by using this code it'll subtract my spell slot two times in a row. ?{Convert which slot?|Level 1,!ammo @{selected|token_id} lvl1_slots_expended -1 level 1 slot|Level 2,!ammo @{selected|token_id} lvl2_slots_expended -1 level 2 slot} ?{Convert which slot?|Level 1,!ammo @{selected|token_id} repeating_resource_$0_resource_right +2 sorcery point|Level 2,!ammo @{selected|token_id} repeating_resource_$0_resource_right +3 sorcery point} Sure enough, If I change the name of the query, it work out, but this require me to answer the choice 2 time so I want to know if there's a way to make this more compact, and work by answering only 1 choice ?{Convert which slot?|Level 1,!ammo @{selected|token_id} lvl1_slots_expended -1 level 1 slot|Level 2,!ammo @{selected|token_id} lvl2_slots_expended -1 level 2 slot} ?{Confirm Slot|Level 1,!ammo @{selected|token_id} repeating_resource_$0_resource_right +2 sorcery point|Level 2,!ammo @{selected|token_id} repeating_resource_$0_resource_right +3 sorcery point}
1585711295
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Keep in mind that that section of the sheet is weird. The repeating sections are only for added rows. It goes class_resource   other_resource repeating_resource_left  repeating_resource_right So that section has two static fields and two repeating field sets. It makes it very difficult to program one-size-fits-all resource solutions.
keithcurtis said: Keep in mind that that section of the sheet is weird. The repeating sections are only for added rows. It goes class_resource   other_resource repeating_resource_left  repeating_resource_right So that section has two static fields and two repeating field sets. It makes it very difficult to program one-size-fits-all resource solutions. Hmm, I see. I understand, I'll make do with what possible, it certainly is still more convenient than opening character sheet and clicking, haha! Thank you for your answer!