delericho
Legend
Doh! I've made a stupid mistake - one of those that is obvious as soon as you spot it.
Reverse the order of the last three clauses in the if... else if... tree - that is, handle the >100 case first then the >95 and then >90, and that should get it.
Reverse the order of the last three clauses in the if... else if... tree - that is, handle the >100 case first then the >95 and then >90, and that should get it.
Code:
var oldStat = this.getField("St.0").value var newStat = this.getField("NewStat1").value
var oldVal = 0
var newVal = 0
if(oldStat <= 90) { oldVal = oldStat }
else if(oldStat > 100) { oldVal = 115 + ((oldStat - 100) * 10) }
else if(oldStat > 95) { oldVal = 100 + ((oldStat - 95) * 3) }
else if(oldStat > 90) { oldVal = 90 + ((oldStat - 90) * 2) }
if(newStat <= 90) { newVal = newStat }
else if(newStat > 100) { newVal = 115 + ((newStat - 100) * 10) }
else if(newStat > 95) { newVal = 100 + ((newStat - 95) * 3) }
else if(newStat > 90) { newVal = 90 + ((newStat - 90) * 2) }
event.value = (newVal - oldVal)