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

Is it possible to grab a value from a calculated field in a specific repeater?

I have a repeater for skill categories. One of the skill categories is Firearms, and within that category is the specific skill of Handheld. The idea is that each column relates to a given Stat (body, mind, EQ, Quick). So the player wants a new skill category (like Law). They add a new row, we negotiate some names for how some or all of the stats might relate to Law (Body + Law = ???, Mind + Law = Infractions...) The idea is that I'd like to take that -2 from Firearms and have it be used as the skill value in the weapons repeater I just made. So that the players don't need to enter that -2 into each weapon to get the dice to work. (that -2 is calculated based on the Title (Untrained(-2)) as a modifier to the related Stat (Quick of 0) in this screenshot)
Pretty sure I found part of the answer here- <a href="https://wiki.roll20.net/Macros#Referencing_Repeating_Attributes" rel="nofollow">https://wiki.roll20.net/Macros#Referencing_Repeating_Attributes</a> Now I just need to get the value in one of the 4 cells that represent the level of that specialty.
1586813337
GiGs
Pro
Sheet Author
API Scripter
Thats for using repeating sections in a macro, not a sheet worker. Which are you trying to do? I'm not following your first post - is the stuff about law, body and so on relevant?
Perhaps the code would help. I've got these repeating sections for skills. Skills come in categories (rows) and then stat-related specialties (columns). So, you've got the category of Firearms, with specialties of Heavy (Body), Maintain/Repair (Mind), none (EQ), Handheld (Quick). I'm hoping to extract the value in the "skill rating" box (that -2 under Handheld) and employ that in that Ranged Weapons sheetworker you helped me get working yesterday (thanks for that, it's amazing). Here's the code- &lt;div class="sheet-skills"&gt; &lt;h1 class="sheet-section"&gt;Skills&lt;/h1&gt; &lt;table width="100%" class="t2"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th width="28%"&gt;Skill&lt;/th&gt; &lt;th width="18%"&gt;Body&lt;/th&gt; &lt;th width="18%"&gt;Mind&lt;/th&gt; &lt;th width="18%"&gt;EQ&lt;/th&gt; &lt;th width="18%"&gt;Quick&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;/table&gt; &lt;fieldset class="repeating_skills"&gt; &lt;table width="100%" class="t2"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" STYLE="color: #1C2833; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #D0D3D4;" name="attr_Skill"&gt; &lt;/td&gt; &lt;td bgcolor="#F5B7B1" colspan="4"&gt; &lt;input type="text" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F9EBEA;" name="attr_SkillBody"&gt; &lt;/td&gt; &lt;/td&gt; &lt;td bgcolor="#85C1E9" colspan="4"&gt; &lt;input type="text" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #D4E6F1;" name="attr_SkillMind"&gt; &lt;/td&gt; &lt;/td&gt; &lt;td bgcolor="#48C9B0" colspan="4"&gt; &lt;input type="text" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #D4EFDF;" name="attr_SkillEQ"&gt; &lt;/td&gt; &lt;/td&gt; &lt;td bgcolor="#F5B7B1" colspan="4"&gt; &lt;input type="text" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F6DDCC;" name="attr_SkillQuick"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" STYLE="color: #1C2833; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #D0D3D4;" name="attr_Skill-1"&gt; &lt;/td&gt; &lt;td bgcolor="#F5B7B1" colspan="4"&gt; &lt;select name="attr_SkillTitleBody"&gt; &lt;option selected disabled&gt;&lt;/option&gt; &lt;option value="-2"&gt;Untrained&lt;/option&gt; &lt;option value="0"&gt;Novice&lt;/option&gt; &lt;option value="1"&gt;Apprentice&lt;/option&gt; &lt;option value="2"&gt;Journeyman&lt;/option&gt; &lt;option value="3"&gt;Master&lt;/option&gt; &lt;option value="4"&gt;Grandmaster&lt;/option&gt; &lt;option value="5"&gt;Grandmaster + 1&lt;/option&gt; &lt;option value="6"&gt;Grandmaster + 2&lt;/option&gt; &lt;option value="7"&gt;Grandmaster + 3&lt;/option&gt; &lt;option value="8"&gt;Grandmaster + 4&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td bgcolor="#85C1E9" colspan="4"&gt; &lt;select name="attr_SkillTitleMind"&gt; &lt;option selected disabled&gt;&lt;/option&gt; &lt;option value="-2"&gt;Untrained&lt;/option&gt; &lt;option value="0"&gt;Novice&lt;/option&gt; &lt;option value="1"&gt;Apprentice&lt;/option&gt; &lt;option value="2"&gt;Journeyman&lt;/option&gt; &lt;option value="3"&gt;Master&lt;/option&gt; &lt;option value="4"&gt;Grandmaster&lt;/option&gt; &lt;option value="5"&gt;Grandmaster + 1&lt;/option&gt; &lt;option value="6"&gt;Grandmaster + 2&lt;/option&gt; &lt;option value="7"&gt;Grandmaster + 3&lt;/option&gt; &lt;option value="8"&gt;Grandmaster + 4&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td bgcolor="#48C9B0" colspan="4"&gt; &lt;select name="attr_SkillTitleEQ"&gt; &lt;option selected disabled&gt;&lt;/option&gt; &lt;option value="-2"&gt;Untrained&lt;/option&gt; &lt;option value="0"&gt;Novice&lt;/option&gt; &lt;option value="1"&gt;Apprentice&lt;/option&gt; &lt;option value="2"&gt;Journeyman&lt;/option&gt; &lt;option value="3"&gt;Master&lt;/option&gt; &lt;option value="4"&gt;Grandmaster&lt;/option&gt; &lt;option value="5"&gt;Grandmaster + 1&lt;/option&gt; &lt;option value="6"&gt;Grandmaster + 2&lt;/option&gt; &lt;option value="7"&gt;Grandmaster + 3&lt;/option&gt; &lt;option value="8"&gt;Grandmaster + 4&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td bgcolor="#F5B041" colspan="4"&gt; &lt;select name="attr_SkillTitleQuick"&gt; &lt;option selected disabled&gt;&lt;/option&gt; &lt;option value="-2"&gt;Untrained&lt;/option&gt; &lt;option value="0"&gt;Novice&lt;/option&gt; &lt;option value="1"&gt;Apprentice&lt;/option&gt; &lt;option value="2"&gt;Journeyman&lt;/option&gt; &lt;option value="3"&gt;Master&lt;/option&gt; &lt;option value="4"&gt;Grandmaster&lt;/option&gt; &lt;option value="5"&gt;Grandmaster + 1&lt;/option&gt; &lt;option value="6"&gt;Grandmaster + 2&lt;/option&gt; &lt;option value="7"&gt;Grandmaster + 3&lt;/option&gt; &lt;option value="8"&gt;Grandmaster + 4&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="text" STYLE="color: #1C2833; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #D0D3D4;" name="attr_Skill-2"&gt; &lt;/td&gt; &lt;td bgcolor="#F5B7B1"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F9EBEA;" name="attr_SkillRatingBody" value="@{Body} + @{SkillTitleBody}" disabled&gt; &lt;/td&gt; &lt;td bgcolor="#F5B7B1"&gt; &lt;button type="roll" title="Roll against Body" value="!continuum @{Skill}|@{SkillRatingBody}|[[ ?{Modifiers not including IP|0} - @{IPTOTal}]]"&gt;&lt;/button&gt; &lt;/td&gt; &lt;td bgcolor="#F5B7B1"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F9EBEA;" name="attr_SkillProgressBody" value="0" min="0"&gt; &lt;/td&gt; &lt;td bgcolor="#F5B7B1"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F9EBEA;" name="attr_SkillProgressMax" value="(@{SkillTitleBody} + 1) * 10" disabled&gt; &lt;/td&gt; &lt;td bgcolor="#85C1E9"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #D4E6F1;" name="attr_SkillRatingMind" value="@{Mind} + @{SkillTitleMind}" disabled&gt; &lt;/td&gt; &lt;td bgcolor="#85C1E9"&gt; &lt;button type="roll" title="Roll against Mind" value="!continuum @{Skill}|@{SkillRatingMind}|[[ ?{Modifiers not including IP|0} - @{IPTOTal}]]"&gt;&lt;/button&gt; &lt;/td&gt; &lt;td bgcolor="#85C1E9"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #D4E6F1;" name="attr_SkillProgressMind" value="0" min="0"&gt; &lt;/td&gt; &lt;td bgcolor="#85C1E9"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #D4E6F1;" name="attr_SkillProgressMax" value="(@{SkillTitleMind} + 1) * 10" disabled&gt; &lt;/td&gt; &lt;td bgcolor="#48C9B0"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #D4EFDF;" name="attr_SkillRatingEQ" value="@{EQ} + @{SkillTitleEQ}" disabled&gt; &lt;/td&gt; &lt;td bgcolor="#48C9B0"&gt; &lt;button type="roll" title="Roll against EQ" value="!continuum @{Skill}|@{SkillRatingEQ}|[[ ?{Modifiers not including IP|0} - @{IPTOTal}]]"&gt;&lt;/button&gt; &lt;/td&gt; &lt;td bgcolor="#48C9B0"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #D4EFDF;" name="attr_SkillProgressEQ" value="0" min="0"&gt; &lt;/td&gt; &lt;td bgcolor="#48C9B0"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #D4EFDF;" name="attr_SkillProgressMax" value="(@{SkillTitleEQ} + 1) * 10" disabled&gt; &lt;/td&gt; &lt;td bgcolor="#F5B041"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F6DDCC;" name="attr_SkillRatingQuick" value="@{Quick} + @{SkillTitleQuick}" disabled&gt; &lt;/td&gt; &lt;td bgcolor="#F5B041"&gt; &lt;button type="roll" title="Roll against Quick" value="!continuum @{Skill}|@{SkillRatingQuick}|[[ ?{Modifiers not including IP|0} - @{IPTOTal}]]"&gt;&lt;/button&gt; &lt;/td&gt; &lt;td bgcolor="#F5B041"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F6DDCC;" name="attr_SkillProgressQuick" value="0" min="0"&gt; &lt;/td&gt; &lt;td bgcolor="#F5B041"&gt; &lt;input type="number" STYLE="color: #1C2833; font-family: Verdana; font-size: 12px; background-color: #F6DDCC;" name="attr_SkillProgressMax" value="(@{SkillTitleQuick} + 1) * 10" disabled&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/fieldset&gt; &lt;/div&gt; and for your convenience, here's the repeater for the RangedWeapons- &lt;fieldset class="repeating_rangedweapons"&gt; &lt;table width="100%"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th width="25%"&gt;Weapon&lt;/th&gt; &lt;th width="13%"&gt;Rating&lt;/th&gt; &lt;th width="7%"&gt;Ammo&lt;/th&gt; &lt;th width="7%"&gt;RoF&lt;/th&gt; &lt;th width="7%"&gt;Conceal&lt;/th&gt; &lt;th style="text-align:center" colspan="8"&gt;Damage&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="25%"&gt; &lt;select name="attr_RangedWeaponType"&gt; &lt;option selected&gt;&lt;/option&gt; &lt;option &gt;Derringer&lt;/option&gt; &lt;option &gt;Revolver&lt;/option&gt; &lt;option &gt;Semi_Auto&lt;/option&gt; &lt;option &gt;Heavy_Pistol&lt;/option&gt; &lt;option &gt;Hungting_Rifle&lt;/option&gt; &lt;option &gt;Shotgun&lt;/option&gt; &lt;option &gt;Shotgun_solid_slugs&lt;/option&gt; &lt;option &gt;Assult_Rifle&lt;/option&gt; &lt;option &gt;SMG&lt;/option&gt; &lt;option &gt;LMG&lt;/option&gt; &lt;option &gt;HMG&lt;/option&gt; &lt;option &gt;Taser&lt;/option&gt; &lt;option &gt;Crossbow&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;td width="13%"&gt; &lt;input type="number" name="attr_RangedWeaponRating"&gt; &lt;button type="roll" title="Roll to hit" value="!continuum @{Weapon}|@{WeaponRating}|[[ ?{Modifiers not including IP|0} - @{IPTOTal}]]||combat"&gt;&lt;/button&gt; &lt;/td&gt; &lt;td width="7%"&gt;&lt;input type="number" name="attr_RangedAmmo" min="0" readonly&gt;&lt;/td&gt; &lt;td width="7%"&gt;&lt;input type="number" name="attr_RangedRoF" min="0" readonly&gt;&lt;/td&gt; &lt;td width="7%"&gt;&lt;input type="number" name="attr_RangedConceal" readonly&gt;&lt;/td&gt; &lt;td style="text-align:right" width="2%" readonly&gt;D&lt;/td&gt; &lt;td width="5%"&gt;&lt;input type="text" name="attr_RangedDamageD" readonly&gt;&lt;/td&gt; &lt;td style="text-align:right" width="2%" readonly&gt;C&lt;/td&gt; &lt;td width="5%"&gt;&lt;input type="text" name="attr_RangedDamageC" readonly&gt;&lt;/td&gt; &lt;td style="text-align:right" width="2%" readonly&gt;B&lt;/td&gt; &lt;td width="5%"&gt;&lt;input type="text" name="attr_RangedDamageB" readonly&gt;&lt;/td&gt; &lt;td style="text-align:right" width="2%" readonly&gt;A&lt;/td&gt; &lt;td width="5%"&gt;&lt;input type="text" name="attr_RangedDamageA" readonly&gt;&lt;/td&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/fieldset&gt; What I'm hoping to do is use that Skill value (the -2) in the RangedWeapon repeater in the&nbsp; &lt;input type="number" name="attr_RangedWeaponRating"&gt; line.
1586815767
GiGs
Pro
Sheet Author
API Scripter
The skill section is a repeating section? and you want to use the modifier from a specific row in the other repeating section?&nbsp; The picture you have doesnt look like a repeating section. And honestly, if you want to proceed with this, you are better off making your skill section a fixed list, not a repeating section. You can use CSS to hide those that players dont have. But if you have a defined skill list, you should set it up as a fixed set of attributes, not a repeating section. That makes the coding easier, and also makes it easier for players who want to make their own macros to use the skills in their macros. If you insist on keeping them both as repeating sections, it gets very complicated, for more than one reason: First, you need some way of matching up which row contains the weapon skill. If you dont define it, your sheet worker has to watch the entire repeating section, and every time every attribute changes, it has to check if the skill that changed is the one relevant to the other section, then it has scan the entire weapon repeating section and change the attribute on every row of that section. So you will need the getSectionIDs function, and worse, will need to nest two instances of it, once for each repeating section. Your going to have loops within loops. There's another issue: How is the name Handheld being entered into a box? Is it in a select? If it's in an input, this is pretty much a non-starter, because as you've found, names in sheet workers have to be spelled exactly, and players will make typos. Some typos will simply fail, others might crash the sheet worker if not properly handled. Also what happens if they enter handheld on two rows of the repeating skill section?&nbsp; My recommendation: if you have a defined skill list, don't make that a repeating section. You can create the code for all the skills, then use CSS to hide the ones players arent skilled in. You'll still have to use getSectionIDs for the repeating_rangedweapons section, but the code is massively simpler and safer with a defined skill attribute name to use.
That's some pretty sound advice right there. I'll consider it. We use a repeating section because the list of skills is still in flux, and we're adding and removing stuff all the time. But the list is settling down now. Now I have to go and learn how to use CSS to hide stuff. That will help me with another task on my list: hiding sections of a character sheet from some players till they level up to the point that they can see/use that previously hidden stuff.