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

Modifying a repeated section value from script?

1476725940

Edited 1476726060
I've constructed an ID for a repeated section attribute with the following: var armorTempHealth="repeating_Armor_"+idarray[i]+"_ArmorTempHealth"; And I know how to get the value of the attribute with this: getAttrs([armorTempHealth],function(values){ //dostuff }); What I don't know how to do is push a value back into that attribute through a string of its attribute name, not a hard-coded instance of its name, with something like this: setAttrs({[armorTempHealth]: tempCurrent},null,function(){ //dostuff }); What am I missing here? I've tried to Google this, but I'm getting a lot of nothing, so I feel like if I knew what to Google I might not need to Google the answer in the first place.
hello, i think that you have to create an array off key/value association and use it in your setattr call. something like: var arrAttrField={}; in the loop : arrAttrFields[armorTempHealth]=tempCurrent; aster the loop: setAttrs(arrAttrFields);