5 Replies Latest reply on May 7, 2017 2:38 PM by gkaiseril

    Custom Calculation Script Based On Custom Calculation Script




      I'm having some troubles with calculating something (This is for a DnD pdf).

      I have already gotten loads of scripts working, but my big trouble is when I have a Custom Calculation Script that is dependent upon another Custom Calculation Script to calculate a number...


      Let's assume I have:


      a) A user input field, called "Dexterity".       (Could store the value: 16)


      b) Is a Custom Calcution Script (Let's call it "Modifier" that depends on "Dexterity",

      to calculate its value.   (("DEX" - 10) / 2)      (Calculated would be: 3)


      My script (Simplified) would be:


      event.value = (this.getField("Dexterity").value - 10) / 2;


      c) A field (Let's call it "Stealth") that calculates a total value from the "Modifier"

      and another User Input Field.     (Such as above value + 2 from the User Input Field, total: 5)


      My script (Simplified) would be:


      event.value = this.getField("Modifier").value + this.getField("NewUserInput").value;




      The problem here is c) ("Stealth")

      It simply will not calculate it, if it's based on another calculation script ("Modifier"), but will do it, if I use the code from the b) ("Modifier") calculation.

      This would not be a problem, of course, except for the fact that I might have an additional changes to the value of "Modifier" based on something different in the sheet´.


      I hoped this would work, so it calculate everything very dynamically and nice, but this problem has stumped me for the last 5-6 hours, and I simply don't know what to google to see if anyone has the same problem as me..


      Thanks in advance!



      Best Regards.