Given my code below... I'm not seeing the values I would expect in the 'brawl' attribute (it should be the sum of the values in the 'brawlEvent' and 'brawlWeapon' attributes). Can anyone tell me why this is not working the way I'd expect it to? The value in 'brawl' should be 6, but I either get 00 or another wrong numeric value. The console log statements aren't displaying what I would expect either. I see "0" and "00", not "3", "3", and "6". Prior to the code shown here I'm using sendChat twice to roll dice and set the 'brawlEvent' and 'brawlWeapon' attribute values for the selected token's character, then I want to sum them to save in its 'brawl' attribute. Am I running into some synchronicity issue here? Where I'm trying to retrieve the values of these two attributes before they've actually been changed? var brawlEvent = findObjs({_type: "attribute", _characterid: char_id, _name: 'brawlEvent'})[0];
var brawlWeapon = findObjs({_type: "attribute", _characterid: char_id, _name: 'brawlWeapon'})[0];
var iBrawlEvent = brawlEvent.get('current');
var iBrawlWeapon = brawlWeapon.get('current');
var iBrawl = iBrawlEvent + iBrawlWeapon;
log(iBrawlEvent);
log(iBrawlWeapon);
log(iBrawl);
brawl2 = findObjs({_type: "attribute", _characterid: char_id, _name: 'brawl'})[0];
brawl2.set('current', iBrawl);