Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Redcap's Corner
Senior Member
 
Join Date: Jul 2010
Posts: 149

Old March 2nd, 2015, 07:59 PM
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
Redcap's Corner is offline   #1 Reply With Quote
Redcap's Corner
Senior Member
 
Join Date: Jul 2010
Posts: 149

Old March 2nd, 2015, 08:04 PM
Nevermind. I should have tried a little harder to parse the error message. I understand what's making Hero Lab cranky.
Redcap's Corner is offline   #2 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old March 2nd, 2015, 08:12 PM
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.

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.
ShadowChemosh is offline   #3 Reply With Quote
Redcap's Corner
Senior Member
 
Join Date: Jul 2010
Posts: 149

Old March 2nd, 2015, 08:51 PM
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
Redcap's Corner is offline   #4 Reply With Quote
AndrewD2
Senior Member
 
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975

Old March 2nd, 2015, 09:03 PM
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
AndrewD2 is offline   #5 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old March 2nd, 2015, 09:15 PM
Quote:
Originally Posted by Redcap's Corner View Post
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.

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.
ShadowChemosh is offline   #6 Reply With Quote
Redcap's Corner
Senior Member
 
Join Date: Jul 2010
Posts: 149

Old March 2nd, 2015, 09:45 PM
Quote:
Originally Posted by ShadowChemosh View Post
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.

Quote:
Originally Posted by ShadowChemosh View 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!
Redcap's Corner is offline   #7 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 11:02 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.