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

Finding the specific row of a repeating section thru a macro?

Hi all I searched the web in vain...  Here it is: I'm trying to find a specific row in a repeating section to use parts of it in calculations.  Use case: I'm using the Cyberpunk 2k20 v2 character sheet. The Weapons section is a repeating section. You can enter as many guns as you want and fill in some info on it. There is also a checkbox for each weapon that you can check or uncheck. I would like to be able to find the Weapon Accuracy  and Damage values of a selected weapon so that I can add it to a check roll and a corresponding damage roll.  I wish to do this thru macros, not API.  Is it possible? If so, how?  Thank you!! 
1586234741

Edited 1586234827
Kraynic
Pro
Sheet Author
Ok, when you reference an attribute, it is generally a fairly straight forward thing (like @{strength}, or whatever), but it is a bit more complicated with repeating sections.&nbsp; An attribute call for an element of a repeating section will always have 3 parts in the name in between the curly brackets: 1. The name of the repeating section. 2. The row ID. 3. The attribute in the repeating section you want to retrieve. Each one of those things will have an underscore between them. Since I don't play that system, I looked up the sheet on github:&nbsp; <a href="https://github.com/Roll20/roll20-character-sheets/tree/master/Cyberpunk2k20_v2" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/tree/master/Cyberpunk2k20_v2</a> If I am reading this right, the weapon repeating section starts at line 2057. 1. The name of the repeating section:&nbsp; @{repeating_wp 2. The easiest way to designate a row is to use $(insert row number here counting from 0 for the first row): $0 3. The attribute in the repeating section.&nbsp; We have the choice of wp-name, wp-type, wp-wa, wp-dmg, wp-rof, wp-range, and wp-desc (I'll do damage): wp-dmg} So if I wanted to pull the damage roll from the first row of that repeating section (if I have done this right without creating a game to test it), it should be: @{repeating_wp_$0_wp-dmg}
Yep I get this, thank you.&nbsp; What I'm missing is a way to look at a row based on a condition. I would need to be able to tell the macro something like: 1. Check the weapons repeating section for character X 2. Find the row where the "selected weapon" check box is checked 3. For this row, pull both damage and weapon accuracy My issue is around finding the right row. I don't know which it is and it can change. Player or npc could switch from a handgun to a rifle or a blade for example. I need to be able to check a row based on a the value of one element and run thru the table until I find such an element.&nbsp; Makes sense?&nbsp;
1586264214
GiGs
Pro
Sheet Author
API Scripter
You cant do that kind of analysis without an API script (a Pro subscriber feature) - normal macros are not capable of that.
Gosh darn it, okidoki Thanks!&nbsp;