View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old June 17th, 2012, 07:05 PM
This article is part of a collection of editor and scripting articles: http://forums.wolflair.com/showthread.php?t=21688

In Hero Lab's scripting languages, the standard math operations are of course available:

+
-
*
/

So, you can write instructions like:

hero.child[skClimb].field[Bonus].value = hero.child[skClimb].field[Bonus].value + 2

There's also a way to abbreviate that, so you don't have to type as much:

+=
-=
*=
/=

Here's the same instruction, with the abbreviation:

hero.child[skClimb].field[Bonus].value += 2

These abbreviations remove the need to repeat the base thing.

Other common math operations:
  • maximum(A,B)
    • Returns the value of whichever of A or B is higher
  • minimum(A,B)
    • Returns the value of whichever of A or B is lower
  • round(A,# of decimal places,direction]
    • # of digits is the number of decimal places you want. Pathfinder almost never uses decimals, so this will almost always be 0.
    • direction is the direction to round the number. Entering a number that's less than 0 (like -1) will make it round down. Entering 0 will use normal rounding (0.5 and above rounds up, 0.499999 and below rounds down). Entering a number greater than 0 (like 1) will make it round up. The Pathfinder rules say that rounding down is the default, so you'll almost always be using -1 as the direction to round.
For a more complete list, see here: http://hlkitwiki.wolflair.com/index....age_Intrinsics (operations like raising something to a power, finding roots, and taking the modulus are also available, but won't be commonly used)

Last edited by Mathias; June 19th, 2012 at 09:40 AM.
Mathias is online now   #1 Reply With Quote