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

Macro Question - Get character sheet table row information

Hello! I'm playing Mutant Year Zero, and the Mutant Character Sheet uses tables for some of the attributes. I can get information from the first row in the table using macros, but I don't know how to get a specific row, or all rows. What I want to make is a macro that checks all weapons in the table, and the user can select the weapon he wants to use. Also, a macro that checks total weight would be cool. Link to the Character Sheet:&nbsp; <a href="https://github.com/Roll20/roll20-character-sheets/tree/master/Mutant%20Year%20Zero%20Alternative" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/tree/master/Mutant%20Year%20Zero%20Alternative</a>
1473773673
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hi Kabe, I don't know much about that system other than seeing it on the forums occassionally, but it looks like it is using the repeating section capability of sheets. How do you reference the stats in the first row? -Scott
1473776070

Edited 1473776142
The first line is not part of the repeating section. You can reference the attributes in the gear repeating section with the following: @{repeating_gear_$0_gear-name-repeating} @{repeating_gear_$0_gearencumberance} (Note: no typo, the field is called this way) @{repeating_gear_$0_gear-rating-repeating} @{repeating_gear_$0_gear-rank-repeating|max} @{repeating_gear_$0_gear-amount-repeating} @{repeating_gear_$0_gear-carried-repeating} With those you will get the contents of the second row of the gear section (since the first is not part of the repeating section). To access the third row change all "0" to "1" and so forth (ex.: @{repeating_gear_$1_gear-name-repeating} ). To my knowledge it is not possible with macros to do something like "for all items in repeating section do {...}". So you have to manually specifiy&nbsp;in your macro which attributes you want to access. If you add new equipment you also have to add the corresponding entry in your macro (same for deleting items; else you will get some ugly "repeating section X not found" errors in the chat).
Hey Scott and Tox! Thank you for taking your time to help me. The code that you gave me Tox works! Thank you! Too bad that it's not possible to loop through all row entries. But I think I can work with this.
1473784086
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, auto looping through them all would be the domain of the API (Pro Perk)