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

Unique Identifiers for Macros in Repeating Sections

Hello, I have a repeating section dealing with powers from DnD 4E using a modified GiffyGlyph 5e sheet. My DM heavily uses macros to control his game, and players use their powers through macros he has set up on their tokens. He wants to be able to update if the power has been expended on the character sheet when the power is used and when it has been recharged during rests in these macros. However, he does not want to deal with finding the row ID of each identifiable power in the repeating sections. He wants the ability to update @{power-x-used} like he would in the standard 4e sheet.   Is it possible to add unique identifiers to elements in a repeating section such that they can be accessed without using the row ID or row index? Or is there some other method of accomplishing this through the sheetworker? Otherwise, I will have to create hardcoded power slots like they do in the original 4e character sheet. Thank you for helping.
1698973714
GiGs
Pro
Sheet Author
API Scripter
If you are launching the ability from a row in a repeating section, and using a sheet worker, Roll20 will automatically add the correct row index. You don't need to create a unique identifier for the row. This requires editing the character sheet. A second method: each row already has a unique identifier, the row id. You can insert the row id using a sheet worker which is then visible for players and GMs to use in macros. But this also requires editing the character sheet. However , if you want to launch a macro that makes a roll and changes an attribute value, you need to be using a Custom Roll Parsing (or a custom script). Your question lacks the details needed to help you with an actual code solution, but what you want is doable. Exacty how its done depends on your approach.
1698976349

Edited 1698976370
All powers are being launched as a token ability. The power checkbox on the character sheet should then respond as an attribute called power-x-used would be modified by the ability. An example of a token ability would be this. It uses the ChatSetAttrscript. /w TestCharA [Short Rest](!setattr --name TestCharA --silent --power-1-used|0) power-1-used would be set to 1 initially to show that the power has been used. After this ability, power-1-used would be 0, meaning the checkbox linked to this attribute should theoretically should be unchecked. The repeating section row is not used to launch the ability, it is there to show the player if it is available to be used. I understand that to access a repeating section row I would need the Row ID or index, which I know I can find and access in some manner like it says in the wiki. @{TestCharA|repeating_encounters_$0_used} // refers to the first row by index @{TestcharA|repeating_encounters_-KC0zCLum1Rq3V5wssyE_used} //reference by RowID However, is it possible to still use repeating sections and be able to write something that accesses them without using row ID or index? @{TestCharA|power-1-used} @{TestcharA|power-2-used} The repeating sections don't let me edit a unique attribute for each power. Right now each row will have a checkbox named attr_encounter_active, but can I make it so that the checkbox is attr_power-x-used? Where x is different for each power in the repeating section. I don't think I can use custom roll parsing because it requires an action button to be clicked on the sheet itself. I don't mind editing the character sheet, I am the one modifying it. But if this is really difficult I don't mind not using repeating sections or trying to talk to the DM to use the row ID method instead.
1699013063

Edited 1699013158
GiGs
Pro
Sheet Author
API Scripter
EleventhHour said: I don't think I can use custom roll parsing because it requires an action button to be clicked on the sheet itself. Action buttons on a sheet are just abilities, and can be called in the same way abilities are called. They can be placed in token actions. You do need to have an identified for the character, but if using token actions, you can use selected, since the token will always be selected. %{selected|ACTION-BUTTON-NAME} For the meat of your question, when you access something the repeating section the RowID is always being used, but roll20 might be hiding that fact for ease of use. If you are running a macro in a repeating section, a CRP sheet worker can change an attribute value on the same row without needing the row id to be explicitly supplied. If you want to use a unique identifier, that can be done, but then your script would need to search through the repeating section each time, find that unique id, get the attribute name of that unique id, get the row id from that, and then use the row id to target the attribute you actually want. That is complex! And you'd need to supply the correct identifier - there's room for typos here messing things up. I see your GM is using a script (chatSetAttrs) but you are talking about creating a checkbox. Does that mean editing the sheet is possible? If sheet editing is possible, you can do this more simply using CRP (one of the rare instances where CRP is described as more simple), and you wouldnt need to use chatSetAttrs
Action buttons on a sheet are just abilities, and can be called in the same way abilities are called. They can be placed in token actions. You do need to have an identified for the character, but if using token actions, you can use selected, since the token will always be selected. %{selected|ACTION-BUTTON-NAME} That is incredibly useful to know! If you want to use a unique identifier, that can be done, but then your script would need to search through the repeating section each time, find that unique id, get the attribute name of that unique id, get the row id from that, and then use the row id to target the attribute you actually want. That is complex! And you'd need to supply the correct identifier - there's room for typos here messing things up. That does certainly seem complex. And not something I'm eager to do if I don't have to.  I see your GM is using a script (chatSetAttrs) but you are talking about creating a checkbox. Does that mean editing the sheet is possible? If sheet editing is possible, you can do this more simply using CRP (one of the rare instances where CRP is described as more simple), and you wouldnt need to use chatSetAttrs Yes, editing the sheet is possible. I have been modifying Giffyglyph's excellent 5e darker dungeons character sheet to be 4e compatible, I have full access to the sheetworker and the HTML. I will go ahead and take a closer look at CRP as that sounds promising. Thank you for your help!