Try this.
Im assuming AC is the one you want to set, and there is 10 your reading from.
so this should work.
I made a character and gave him all the Att's and set them 10,9,8,7,6,5,4,3,2,1 and it set AC to 55.
What it does is goes thru each of the 'CFG' up top and looks for that att on the character, and adds it to a total and looks for the next one.
I noticed you had
Special-AC-Int as
oSpecial-AC-Int to look for, and assumed it was wrong so I fixed it. If not change it back.
(I noticed a bug/hiccup where it wasnt showing the AC after I tried the first time, I refreshed the roll20 page and looked, it was there from then on everytime I changed it..not sure why...or cAC being undefined, so I forced it to check and set 0 if it is just incase.)
var CFG = [
{Att: 'Base-AC-Value',},
{Att: 'Armor-Bonus',},
{Att: 'Dexterity',},
{Att: 'Dodge-Bonus',},
{Att: 'Natural-AC',},
{Att: 'Shield-Bonus',},
{Att: 'Deflection',},
{Att: 'AC-Penalty',},
{Att: 'Special-AC-Wis',},
{Att: 'Special-AC-Int',}
];
on("change:token", function (obj) {
var cAC = 0;
var mAC = 0;
if(obj.get("represents") == '') return;
var oCharacter = getObj('character', obj.get("_represents"));
CFG.forEach(function (opts) {
if (cAC == null) cAC = 0;
if (mAC == null) mAC = 0;
var oAtt = findObjs({_type: "attribute",name: opts.Att,_characterid: oCharacter.id})[0];
if(oAtt == undefined) return;
var cAtt = parseInt(oAtt.get("current"));
var mAtt = parseInt(oAtt.get("max"));
cAC = cAC + cAtt;
mAC = mAC + mAtt;
});
var oAC = findObjs({_type: "attribute",name: 'AC',_characterid: oCharacter.id})[0];
oAC.set('current', cAC);
oAC.set('max', mAC);
});