
on("change:token", function (obj) { if(obj.get("represents") == '') return; var oCharacter = getObj('character', obj.get("_represents")); var cBy = oCharacter.get('controlledby'); var oBase-AC-Value = findObjs({_type: "attribute",name: "Base-AC-Value",_characterid: oCharacter.id})[0]; var oArmor-Bonus = findObjs({_type: "attribute",name: "Armor-Bonus",_characterid: oCharacter.id})[0]; var oDexterity = findObjs({_type: "attribute",name: "Dexterity",_characterid: oCharacter.id})[0]; var oAC = findObjs({_type: "attribute",name: "AC",_characterid: oCharacter.id})[0]; var oDodge-Bonus = findObjs({_type: "attribute",name: "Dodge-Bonus",_characterid: oCharacter.id})[0]; var oNatural-AC = findObjs({_type: "attribute",name: "Natural-AC",_characterid: oCharacter.id})[0]; var oShield-Bonus = findObjs({_type: "attribute",name: "Shield-Bonus",_characterid: oCharacter.id})[0]; var oDeflection = findObjs({_type: "attribute",name: "Deflection",_characterid: oCharacter.id})[0]; var oAC-Penalty = findObjs({_type: "attribute",name: "AC-Penalty",_characterid: oCharacter.id})[0]; var oSpecial-AC-Wis = findObjs({_type: "attribute",name: "Special-AC-Wis",_characterid: oCharacter.id})[0]; var o oSpecial-AC-Int = findObjs({_type: "attribute",name: " oSpecial-AC-Int",_characterid: oCharacter.id})[0]; if(oBase-AC-Value == undefined || oDexterity == undefined || oAC == undefined || oDodge-Bonus || oNatural-AC == undefined || oDeflection == undefined || oShield == undefined || oArmor-Bonus == undefined || oAC-Penalty== undefined || oSpecial-AC-Wis== undefined || oSpecial-AC-Int== undefined) return; //Dexterity----------------- var cDexterity = parseInt(oDexterity.get("current")); var mDexterity = parseInt(oDexterity.get("max")); //Base-AC-Value----------------- var cBase-AC-Value = parseInt(oBase-AC-Value.get("current")); var mBase-AC-Value = parseInt(oBase-AC-Value.get("max")); //Deflection----------------- var cDeflection = parseInt(oDeflection.get("current")); var mDeflection = parseInt(oDeflection.get("max")); //Natural-AC----------------- var cNatural-AC = parseInt(oNatural-AC.get("current")); var mNatural-AC = parseInt(oNatural-AC.get("max")); //Dodge-Bonus----------------- var cDodge-Bonus = parseInt(oDodge-Bonus.get("current")); var mDodge-Bonus = parseInt(oDodge-Bonus.get("max")); //Shield-Bonus----------------- var cShield-Bonus = parseInt(oShield-Bonus.get("current")); var mShield-Bonus = parseInt(oShield-Bonus.get("max")); //Armor-Bonus----------------- var cArmor-Bonus = parseInt(oArmor-Bonus.get("current")); var mArmor-Bonus = parseInt(oArmor-Bonus.get("max")); //Special-AC-Wis----------------- var cSpecial-AC-Wis = parseInt(oSpecial-AC-Wis.get("current")); var mSpecial-AC-Wis = parseInt(oSpecial-AC-Wis.get("max")); //Special-AC-Int----------------- var cSpecial-AC-Int = parseInt(oSpecial-AC-Int.get("current")); var mSpecial-AC-Int = parseInt(oSpecial-AC-Int.get("max")); //AC-Penalty----------------- var cAC-Penalty = parseInt(oAC-Penalty.get("current")); var mAC-Penalty = parseInt(oAC-Penalty.get("max")); //SetMax----------------------------- var mAC = +mDexterity + +mBase-AC-Value+ +mSpecial-AC-Int+ +mAC-Penalty+ +mSpecial-AC-Wis+ +mShield-Bonus+ +mDodge-Bonus+ +mNatural-AC+ +mDeflection; oAC.set('max', mAC); //SetCurrent---------------------- var cAC = +cDexterity + +cBase-AC-Value+ +cSpecial-AC-Int+ +cAC-Penalty+ +cSpecial-AC-Wis+ +cShield-Bonus+ +cDodge-Bonus+ +cNatural-AC+ +cDeflection; oAC.set('current', cAC); }); I initially, with the help of some other people on this site, made a script that was supposed to add two attributes together. First try was to get it to calculate a characters CMB by adding his strength and his BAB together. It worked great! However, as I decided to take the next step and make a script that calculated a characters armor-class taking everything into account (at least I think I got everything... ), I encountered a problem. The first problem was caused by some formatting mistakes, that were easily corrected. It gave me the "unexpected token" error. But I took care of that and figured that now, it would run smoothly. Instead, it gave me "Unexpected Identifier". I found another post talking about it, but I didn't manage to figure out what I did wrong. I'm very new to this, so I will not understand very technical terms. Thanks in advance.