Need help with a formula!

So I have a new formula I am trying to input into NBOS for my new tabletop game, but I have no idea how to do so. The formula utilizes 3 separate fields to fill one field, but I just can't seem to make it work. I also have very little experience in JS so that is also a factor.

10+((1/4 * Resilience +1/2 * Dodge) + Dex Modifier)

Comments

  • You don´t need Javascript for this, you can use the formula directly in the Source property of a text field.
    However, you need to make sure that all the parenthesizes are in the right place for what you want it to calculate.

    Probably easiest to rewrite the formula as
    10+((Resilience/4 + Dodge/2) + DexModifier)

    Also, don´t use any spaces in the field name(eg DexModifier and not Dex Modifier)

    General tips when it comes to Javascripts are also to avoid underscores(_) in field names and remember that javascript function is case sensitive(normal field calculations are not) and needs fullt qualified field parameter(.Text/.Value).The field property is ALSO case sensitive.

Leave a Comment