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 .
×
D&D 2024 has arrived! Pre-order the new core rulebooks now and get an exclusive pre-order bonus for free!
Create a free account

Getting the row ID for a row with a macro

Is there any way to get the row ID of a row in a repeating section with a macro by an attribute call, API or some weird work around? I'm currently using the 5e OGL sheet but a way for doing this for any sheet would be really helpful.
1511744978

Edited 1511745003
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
What are you trying to do, might have some workarounds if I had more context. A macro won't work at all. You could do a custom API script for your basic question. Some sheets, like the Neceros pathfinder sheet give the rowid as an attribute.
1511746553

Edited 1511746590
I've been having several problems with the repeating attacks section as I posted previously  here , specifically the second issue I spoke of. As I can't seem to fix those issues properly I've decided to try deleting the attack rows that add themselves using ChatSetAttr. Unfortunately, for reasons I don't understand, when I try to edit or delete these rows using a row index CSA ignores the rows I'm trying to delete and goes straight to the rows I wanted to keep. For example in the picture if I use the row index $4 in CSA it will affect Ray of Frost not Ice Knife, however, if I use the row ID for Ice Knife CSA will affect Ice Knife. Normal attribute and ability calls still work for the right row indices so that's why I was hoping to use an attribute call to find the row ID to input that into CSA. Apologies for the text wall and if none of that makes sense I'm pretty sure my brain has turned to mush.
Two things: 1) It seems as if the row index you are passing in refers to the spells order. My guess is that Ray of Frost is in the $4 index in the cantrips section of the spell list (assuming that there is a non-attack spell somewhere before Ray of Frost). 2) You could get the row id for the attack by utilizing the spell list as the spells maintain the row id for the corresponding attack just like how the attacks maintain the row id for the corresponding spell. To get the row id for the corresponding attack inside the macro you could use @{repeating_spell-LEVEL_INDEX_attackid}. The next question would be if ChatSetAttr can handle attributes within an attribute name (namely repeating_attack_@{repeating_spell-LEVEL_INDEX_attackid}_ATTR).
1511805783
chris b.
Pro
Sheet Author
API Scripter
On your browser Hit F12 to bring up the development tools and look at the html, and focus on the repeating section. You can see the row id somewhere in the html. If the sheet creator was nice they might put the row id into a field for macro users. But if not, roll20 puts it in there too as data near the top element around each row. Then you can use it. Obviously deleting and recreating rows, or using it on a different character sheet, will not work without finding the new ID.
Kyle G. said: Two things: 1) It seems as if the row index you are passing in refers to the spells order. My guess is that Ray of Frost is in the $4 index in the cantrips section of the spell list (assuming that there is a non-attack spell somewhere before Ray of Frost). I'm definitely using the repeating attack section and now the spell sections and Ray of Frost is the 3rd spell in the cantrip list as well as I have the same issue with the other spell list, shown in the photo, where $4 acts on Fire Bolt and not Burning Hands. So I don't think this is the problem. 2) You could get the row id for the attack by utilizing the spell list as the spells maintain the row id for the corresponding attack just like how the attacks maintain the row id for the corresponding spell. I don't *think* this works as the attack ID attribute matches the second (and correct) instance of the spell appearing in the attack list, so it will only give the ID of the attack I don't want to change/remove. chris b. said: On your browser Hit F12 to bring up the development tools and look at the html, and focus on the repeating section. You can see the row id somewhere in the html. If the sheet creator was nice they might put the row id into a field for macro users. But if not, roll20 puts it in there too as data near the top element around each row. Then you can use it. Obviously deleting and recreating rows, or using it on a different character sheet, will not work without finding the new ID. I can get the row ID from the HTML but the problem I'm having is getting it within a macro so that the macro can run with it without me needing to go into the HTML and copy paste. I believe I've found the source of the problem to be something to do with unpreparing the spell. When I uncheck the prepared checkbox, with CSA or manually, the spell I unprepared appears in the 5th attack slot with an attack ID lower  than the spell attacks lower down on the list suggesting the attack is somehow how made before the others even though it only appears much later and only if I 'unprepare' the spell. Therefore, my only current solution is to not touch the prepared checkbox for the spells but I would like a way to fix this problem so I can, in the future, uncheck the box.