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 .
×

Repeating Section and Macro

Hello everyone, I need a little help with repeating section and use of attribute in repeatint section in macro. I modify a existing Sheet of "A Song of Ice and Fire" to add a Army layout with repeating section for armies unit. Symplify HTML code : <div class="sheet-section-armies"> <!-- Armies Tab --> <!--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%--> <div class="sheet-wrapper"> <h3>Armées</h3> <fieldset class="repeating_Army"> <div class="sheet-row"> <div class="sheet-item" style="width:10%"><label>Nom:</label></div> <div class="sheet-item" style="width:50%"><input name="attr_ArmyName" type="text"></div> </div> <input type="checkbox" class="arrow" /><span></span> <!-- This is the selector that enables hiding a grouped area --> <div class="hbody"> <!-- This is the start of the hidden div --> <div class="sheet-quickborder"> <!-- NPC Narrative lines --> <div class="sheet-3colrow"> <div class="sheet-col"> <div class="sheet-row"> <div class="sheet-item" style="width:15%"> <label>Type:</label></div> <div class="sheet-item" style="width:70%"><span class="sheet-item" style="width:50%"> <select class="ArmySelectType" name="attr_ArmyType"> <option value="1">Archer</option> <option value="2">Cavalerie</option> <option value="3">Cavalerie Lourde</option> <option value="4">Conscrit Paysan</option> <option value="5">Criminel</option> <option value="6">Eclaireur</option> <option value="7">Garde d'honneur</option> <option value="8">Garnison</option> <option value="9">Guerilla</option> <option value="10">Infanterie</option> <option value="11">Ingénieur</option> <option value="12">Marin</option> <option value="13">Mercenaire</option> <option value="14">Navire de guerre</option> <option value="15">Pillard</option> <option value="16">Soutien</option> <option value="17">spécialiste</option> </select> </span></div> </div> </div> <div class="sheet-col"> <div class="sheet-row"> <div class="sheet-item" style="width:20%"> <label>Entrainement:</label></div> <div class="sheet-item" style="width:65%"><span class="sheet-item" style="width:50%"> <select class="ArmySelectTraining" name="attr_ArmyTraining"> <option value="3">Bleu</option> <option value="2">Entrainé</option> <option value="1">Vétéran</option> <option value="0">Elite</option> </select> </span></div> </div> </div> <div class="sheet-col"> <div class="sheet-row"> <div class="sheet-item" style="width:20%"> <label>Etat:</label></div> <div class="sheet-item" style="width:65%"><span class="sheet-item" style="width:50%"> <select class="ArmySelectStatus" name="attr_ArmyStatus"> <option value="1">Organisé</option> <option value="2">Désorganisé</option> <option value="3">Réorganisé</option> <option value="4">En déroute</option> </select> </span></div> </div> </div> </div> <div style="height: 4px;"> </div> <div class="sheet-row"> <h3>CARACTERISTIQUES</h3> </div> <br> <div class="sheet-2colrow"> <!-- Left ability column --> <div class="sheet-col"> <div class="sheet-dhhr"></div> <!-- Corps à Corps --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyCac-roll' value='' disabled="true"><label style="vertical-align: middle;">Corps à Corps</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyCac" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Tir --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyTir-roll' value='' disabled="true"><label style="vertical-align: middle;">Tir</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyTir" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Endurance --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyEndurance-roll' value='' disabled="true"><label style="vertical-align: middle;">Endurance</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyEndurance" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Discretion --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyDiscretion-roll' value='' disabled="true"><label style="vertical-align: middle;">Discrétion</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyDiscretion" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> </div> <!-- Right ability column --> <div class="sheet-col"> <div class="sheet-dhhr"></div> <!-- Art Militaire --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyArtmil-roll' value='' disabled="true"><label style="vertical-align: middle;">Art Militaire</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyArtmil" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Athletisme --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyAthletisme-roll' value='' disabled="true"><label style="vertical-align: middle;">Athletisme</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyAthletisme" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Dressage --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyDressage-roll' value='' disabled="true"><label tyle="vertical-align: middle;">Dressage</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyDressage" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Vigilance --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyVigilance-roll' value='' disabled><label style="vertical-align: middle;">Vigilance</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyVigilance" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> </div> </div> <br> <div class="sheet-row"> <h3>COMBAT</h3> </div> <div class="sheet-quickborder"> <div class="sheet-2colrow"> <!-- Left ability column --> <div class="sheet-col"> <div class="sheet-dhhr"></div> <!-- Discipline --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyDiscipline-roll' value='' disabled="true"><label style="vertical-align: middle;">Discipline</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyDiscipline" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Dégat CaC --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyDegcac-roll' value='' disabled="true"><label style="vertical-align: middle;">Dégats CàC</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyDegcac" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Degat Tir --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyDegtir-roll' value='' disabled="true"><label style="vertical-align: middle;">Dégats Tir</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyDegtir" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Défense --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyDefense-roll' value='' disabled="true"><label style="vertical-align: middle;">Défense</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyDefense" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Mouvement --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyMvt-roll' value='' disabled="true"><label style="vertical-align: middle;">Mvt</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyMvt" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> </div> <!-- Right ability column --> <div class="sheet-col"> <div class="sheet-dhhr"></div> <!-- Valeur Armure --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyValarm-roll' value='' disabled="true"><label style="vertical-align: middle;">Valeur Armure</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyValarm" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Penalité Armure --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyPenarm-roll' value='' disabled="true"><label style="vertical-align: middle;">Pénalité Armure</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyPenarm" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Malus Armure --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmyMalarm-roll' value='' disabled="true"><label tyle="vertical-align: middle;">Malus Armure</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmyMalarm" class="unnaturaltext" type="text" value="2"> </div> </div> </div> </div> <div style="height: 4px;"> </div> <!-- Santé --> <div class="sheet-col sheet-characteristics"> <div class="sheet-2colrow"> <div class="sheet-col"> <button type='roll' class='sheet-characteristics' name='attr_ArmySante-roll' value='' disabled="true"><label style="vertical-align: middle;">Santé</label></button> </div> <div class="sheet-col"> <div class="unnatural_box"> <input name="attr_ArmySante" class="unnaturaltext" type="text" value="@{army_endurance}*3" disabled="true"> </div> </div> </div> </div> </div> </div> </div> <br> </div> <div class="sheet-row"></div> </div> </fieldset> </div> <!-- This is the closing div for the hidden grouping for Army repeatable --> </div> The Script @{repeating_Army_0_ArmyName} The script result : TypeError: c is undefined Thanks for your help
1588978989
GiGs
Pro
Sheet Author
API Scripter
This syntax is incorrect @{repeating_Army_0_ArmyName} Try @{repeating_Army_$0_ArmyName}
Same result with the news syntax...
1588980013
GiGs
Pro
Sheet Author
API Scripter
Repeating sections often have issues with uppercase letters. Change <fieldset class="repeating_Army"> to <fieldset class="repeating_army"> and your macro to @{repeating_army_$0_ArmyName}
Sorry i have the same result... You can find&nbsp; the full sheet template here&nbsp; : <a href="https://github.com/noritaka97/Trone_De_Fer" rel="nofollow">https://github.com/noritaka97/Trone_De_Fer</a>
1588984422

Edited 1588984563
vÍnce
Pro
Sheet Author
It works for me. Works with your full code as well
Thanks Vince you just copy/paste the html code and CSS code in the custom template... all my test show army attribute give me the same message in a game or in a sandbox...
@Vince, Do you have attribute in the attribute and hability tab of the characters sheet ?
I'm don't understand the problem...
1589050090
Kraynic
Pro
Sheet Author
Did you change the capitalization in the ArmyName attribute?&nbsp; That is the only difference I can tell between Vince's attempt and yours.&nbsp; The code above is ArmyName, while yours is looking for armyname.
yes i just make change for the repeating section and armyname for testing, but same result. This repository always up to date to the last test with the capitalization of the attribute name. <a href="https://github.com/noritaka97/Trone_De_Fer" rel="nofollow">https://github.com/noritaka97/Trone_De_Fer</a>
1589065522

Edited 1589065816
GiGs
Pro
Sheet Author
API Scripter
I earlier asked about the capitalisation of the repeating section, because there are some obscure situations where that causes a problem. But for 99% of situations, roll20 doesnt care about capitalisation. If you an attribute called MyAttribute, then you can call it with @{MyAttribute}, @{myattribute}, @{MYATTRIBUTE}, or even @{MyAttRiBute}. All of them will work. So the problem here is not capitalisation. it must be something else. This&nbsp;@{repeating_army_$0_ArmyName} should be working, and the fact that it isn't means we dont have all the information. How are you launching that? If its an Ability on the character sheet, it should work. If you're just typing it in chat, or in a macro, it needs a way of identifying which character it should use. Something like @{selected|repeating_army_$0_ArmyName}&nbsp; if you have a token linked to the character , and their token is selected. If thats not the issue, have you tried creating another character, creating an item in the repeating section, and then running it from that character? There might be corruption in the original sheet (rare, but it happens, and we are clutching at straws here).
1589065659

Edited 1589065745
vÍnce
Pro
Sheet Author
Or maybe the token isn't linked to a sheet?
Vince rigth, the token was not liked to the sheet... probably my mistake by the beginning. thanks everyone for your help.
1589071576
vÍnce
Pro
Sheet Author
Love a happy ending. ;-)