Copy link to clipboard
Copied
Hey.
I need a button for my D&D charactersheet to have 2 actions.
The actions would be to add several boxes for a total in a final box, or only a base number put in ther final box. It's about having the proficiency bonus box added to the base stat modifier box, with the total placed into a 3rd box.
Example
Checked : Box 1 + Box 2 = Box 3
Unchecked : Box 1 = Box 3
Copy link to clipboard
Copied
Use this as custom calculation script of "Box 3" and change 'Button' to your actual radio button name.
var b1 = this.getField("Box 1");
var b2 = this.getField("Box 2");
var check = this.getField("Button").valueAsString;
if(check == "Off")
event.value = b1.value;
else
event.value = Number(b1.value)+Number(b2.value);
Copy link to clipboard
Copied
Sorry
I meant to say the checkbox, not button.
Copy link to clipboard
Copied
You also want to show plus sign?
Try this:
var str = this.getField("STR");
var dex = this.getField("DEX");
var check = this.getField("Check Box1").valueAsString;
if(str.valueAsString == "")
event.value = "";
else if(check == "Off")
event.value = "+"+str.value;
else
event.value = "+"+(Number(str.value)+Number(dex.value));
Copy link to clipboard
Copied
Ugh. I forgot something and there isn't an edit button.
OK.
I want the check box to do the following
Checked : Saving throw bonus # = Stat Modifier # + Proficiency Bonus #
Unchecked : Saving throw bonus # = Stat Modifier #
I'm just trying to speed up character creation by having the check boxes in the saving throw modifiers box add the proficiency bonus and the stat modifier together in the saving throw bonus box. A+B=C sort of thing. I'm sorry if you're not familiar with Dungeons & Dragons, but the check box in the Saving Throws Modifiers box mean whether or not the character is "proficient". If they are, the proficiency bonus is added to the stat modifier and that's added to a roll made. It was so the box next to the check box had the math done already, so all a player has to do is add that number to the roll.
Copy link to clipboard
Copied
The stat modifier field has the same name as saving throw (STR) so what ever you put in one will be in all fields with the same name, so that calculation is not possible unless you rename fields or use "STRmod" field as stat modifier?
Once you fix renaming, first script should work just input correct field names and use it as custom calculation script of "STR" field (Saving throw total bonus) like this:
var b1 = this.getField("STRmod");
var b2 = this.getField("ProfBonus");
var check = this.getField("Check Box1").valueAsString;
if(check == "Off")
event.value = b1.value;
else
event.value = Number(b1.value)+Number(b2.value);