Here's another crude script that uses the toggling of the "strong" status as the trigger. CAVEAT: It only detects a single strong status. Multiple strong status (i.e. strong@3) is considered the same as no strong status icon. var CHOSEN_STATUS = "strong";
var STRATTR = "Str-Mod"; var CONATTR = "Con-Mod"; var HPATTR = "HP"; var ACATTR = "AC"; var LEVATTR = "Level";
on("change:graphic:statusmarkers", function(obj, prev) { // Only counts when a single "strong" status is applied, // "strong@X" is considered not "strong" var isStrong = obj.get("status_"+CHOSEN_STATUS) === true; var wasStrong = prev["statusmarkers"].split(',').indexOf(CHOSEN_STATUS)!=-1;
if( isStrong && !wasStrong ) { log("power up!"); var charID = obj.get("represents"); var StrAttr = findObjs({ name: STRATTR, _type: "attribute", _characterid: charID }, {caseInsensitive: true})[0]; var ConAttr = findObjs({ name: CONATTR, _type: "attribute", _characterid: charID }, {caseInsensitive: true})[0]; var HPAttr = findObjs({ name: HPATTR, _type: "attribute", _characterid: charID }, {caseInsensitive: true})[0]; var ACAttr = findObjs({ name: ACATTR, _type: "attribute", _characterid: charID }, {caseInsensitive: true})[0]; var LevAttr = findObjs({ name: LEVATTR, _type: "attribute", _characterid: charID }, {caseInsensitive: true})[0]; sendChat("Rage-API", obj.get("name")+" toggling on."); log(StrAttr.get("current")+" "+ConAttr.get("current")+" "+ACAttr.get("current")+" "+HPAttr.get("current")+" "+LevAttr.get("current")); StrAttr.set("current", parseInt(StrAttr.get("current"))+4); ConAttr.set("current", parseInt(ConAttr.get("current"))+4); HPAttr.set("current", parseInt(HPAttr.get("current"))+(2*parseInt(LevAttr.get("current")))); ACAttr.set("current", parseInt(ACAttr.get("current"))-2); log(StrAttr.get("current")+" "+ConAttr.get("current")+" "+ACAttr.get("current")+" "+HPAttr.get("current")+" "+LevAttr.get("current")); }
if( !isStrong && wasStrong ) { log("weakling!"); var charID = obj.get("represents"); var StrAttr = findObjs({ name: STRATTR, _type: "attribute", _characterid: charID }, {caseInsensitive: true})[0]; var ConAttr = findObjs({ name: CONATTR, _type: "attribute", _characterid: charID }, {caseInsensitive: true})[0]; var HPAttr = findObjs({ name: HPATTR, _type: "attribute", _characterid: charID }, {caseInsensitive: true})[0]; var ACAttr = findObjs({ name: ACATTR, _type: "attribute", _characterid: charID }, {caseInsensitive: true})[0]; var LevAttr = findObjs({ name: LEVATTR, _type: "attribute", _characterid: charID }, {caseInsensitive: true})[0]; sendChat("Rage-API", obj.get("name")+" toggling off."); log(StrAttr.get("current")+" "+ConAttr.get("current")+" "+ACAttr.get("current")+" "+HPAttr.get("current")+" "+LevAttr.get("current")); StrAttr.set("current", parseInt(StrAttr.get("current"))-4); ConAttr.set("current", parseInt(ConAttr.get("current"))-4); HPAttr.set("current", parseInt(HPAttr.get("current"))-(2*parseInt(LevAttr.get("current")))); ACAttr.set("current", parseInt(ACAttr.get("current"))+2); log(StrAttr.get("current")+" "+ConAttr.get("current")+" "+ACAttr.get("current")+" "+HPAttr.get("current")+" "+LevAttr.get("current")); } });