• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

+5 ft. at 12th level and every 5 levels thereafter

Redcap's Corner

Well-known member
Can anyone tell me what's wrong with the following? I've used similar code in other abilities and had no issue. I realize it's a cumbersome formula, but it's a weird progression to have to code.

Code:
field[abRange].value += (round(((field[xAllLev].value - 11) / 5), 0, 1) * 5)

This is the error I get:

Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Thing 'cDstAuFear' (Eval Script '#1') on line 1
-> Error parsing parameter 1 of function
 
There is much easier methods to code Class Abilities. Plus make them totally generic so they can easily be reused. Take a look at THIS post I did in the project forum to help out those working on the Community Packs. Then crazy formulas like you have are not needed.
 
Yeah, I'm familiar with adding multiple instances of a thing and using xCount, but I appreciate it. In this particular case, the power is a chooseable class ability (like a rogue talent), so I'm not sure this applies. The final text I ended up with was:

Code:
var fearbase as number
fearbase = (field[xTotalLev].value - 11) / 5
field[abRange].value += round(fearbase, 0, 1) * 5
 
You could cut out the variable and just do:

Code:
field[abRange].value = field[xTotalLev].value - 11
field[abValue].value = round(field[abRange].value/5, 0, -1)
[code]

saves a little memory that way, but not necesarry
 
a chooseable class ability (like a rogue talent), so I'm not sure this applies. The final text I ended up with was:

Code:
var fearbase as number
fearbase = (field[xTotalLev].value - 11) / 5
field[abRange].value += round(fearbase, 0, 1) * 5
Didn't catch it was a Custom Ability then yea you can't bootstrap. I thought it was a Class Special.

As you found doing too much math in the "round" function does not always take. Like Andrew said I would always use "field[abValue].value" instead of making new variable. One less variable to clean up and does allow you to more easily adjust the value if you ever need to from an outside script.
 
Didn't catch it was a Custom Ability then yea you can't bootstrap. I thought it was a Class Special.

That was my fault. I was incorrectly using xAllLev in my original post.

As you found doing too much math in the "round" function does not always take. Like Andrew said I would always use "field[abValue].value" instead of making new variable. One less variable to clean up and does allow you to more easily adjust the value if you ever need to from an outside script.

Done! I had originally used the variable because I figured the fact that my end result was a value for the abRange field meant it was still editable by outside scripts, but I guess it doesn't hurt to have it editable at two different points in the process. Thanks, guys!
 
Back
Top