Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > Hero Lab Discussion

Notices

Reply
 
Thread Tools Display Modes
Paragon
Senior Member
 
Join Date: Feb 2010
Posts: 874

Old February 11th, 2016, 08:50 AM
I'm getting an error message on an eval script I'm trying to put together, and my suspicion is its a timing issue, but fiddling with that has not fixed the problem, so perhaps I'm missing something. I'm trying to put together an if-then result using two hero fields, and I'm getting an error that one is an "undeclared (not undefined) variable". Any thoughts about what the problem might be from anyone?
Paragon is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old February 11th, 2016, 08:51 AM
All too often, I find that "undeclared variable" means "typo" - there's a mistake, and Hero Lab can't interpret it, and falls back on the assumption that you were trying to use a variable that it hadn't already recorded.
Mathias is online now   #2 Reply With Quote
Paragon
Senior Member
 
Join Date: Feb 2010
Posts: 874

Old February 11th, 2016, 10:38 AM
I'll try it again and see; since I was referring to a floating window with hero fields, a typo is not beyond the realm of reason.
Paragon is offline   #3 Reply With Quote
Paragon
Senior Member
 
Join Date: Feb 2010
Posts: 874

Old February 13th, 2016, 01:13 PM
Okay, I tried it again and I'm getting the same error. I'm going to list the full XML here, and see if anyone sees anything obviously wrong (yes, I'm aware that people won't know the specifics of the system, but since the 4e forum is a graveyard, posting it there is the same as not posting it, where at least here people with general understanding of HL's syntax usage might be able to suggest something). My suspicion is that its timing related because ACHPNow is current hit points, but I don't know how to figure out what timing would help.

Code:
 <thing id="fRDBFuX" name="Dragonborn Fury" description="While you are bloodied, you gain a +1 racial bonus to attack rolls." compset="RaceFeat">
    <eval phase="Initialize" priority="1000"><![CDATA[ doneif (ACHPNow <= ACHPBlood)

      ~add +1 to attacks with weapons
      foreach pick in hero from WeaponBase
        perform eachpick.field[wpBonus].modify[+,1,""]
        nexteach]]></eval>
    </thing>
Paragon is offline   #4 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old February 13th, 2016, 01:25 PM
In that first line, you're using two variables - ACHPNow and ACHPBlood. You'll need to define them before using them, and then set them to some value. Otherwise, you're comparing 0 <= 0, which will always be true
Mathias is online now   #5 Reply With Quote
Paragon
Senior Member
 
Join Date: Feb 2010
Posts: 874

Old February 13th, 2016, 03:30 PM
Quote:
Originally Posted by Mathias View Post
In that first line, you're using two variables - ACHPNow and ACHPBlood. You'll need to define them before using them, and then set them to some value. Otherwise, you're comparing 0 <= 0, which will always be true
They're Hero Fields from the system code; do I need to tell the program to look at the Hero before I can do that?
Paragon is offline   #6 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old February 13th, 2016, 07:26 PM
If they're fields on the hero, then you need to tell Hero Lab that it's looking for a field on the hero:
Code:
doneif (herofield[acHPNow].value <= herofield[acHPBlood])
Remember, capitalization matters - acHPNow, not ACHPNow.

Also, both of those values aren't calculated until Final/9000, so your script, running at Initialize/1000 will always see the value of both as 0, so it will always exit the script.
Mathias is online now   #7 Reply With Quote
Paragon
Senior Member
 
Join Date: Feb 2010
Posts: 874

Old February 13th, 2016, 09:46 PM
Ah. I'd thought that last ,might be part of the issue, but it didn't seem to matter where I positioned it, timing-wise. Now that I understand that I was using the hero fields improperly, I can see why.

Thanks, Mathias.

(And yeah, I probably screwed up the capitalization when I was setting it up--and that's one where I know how fussy HL can be from my various SW projects; my only excuse is I'm fighting with a massive headcold...)
Paragon is offline   #8 Reply With Quote
Paragon
Senior Member
 
Join Date: Feb 2010
Posts: 874

Old March 8th, 2016, 08:18 AM
Finally got back to this and when I the code Matthias suggested I'm getting an "invalid field syntax used" error. Any idea why?
Paragon is offline   #9 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,207

Old March 8th, 2016, 08:25 AM
I don't have enough information to figure out why without seeing the code.

Also, the error message would have included a line number. You can right-click on error messages in HL and copy them, so please paste both the error message and your code here so I can look at them.

And as a homework assignment, find out which line number it says the error is on, look at the line number in the error message, count lines in the script, and identify which line is the problem.
Mathias is online now   #10 Reply With Quote
Reply

Thread Tools
Display Modes

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 03:11 AM.


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