Yep, that was the other syntax error.
(I presume there's a line you haven't copied that adds the sp variable to field[trkMax].value)
Now for timing.
Going into the editor's help menu, and looking at the "Choosing a Phase" link at the bottom, here's the description of the Final phase:
Quote:
Should be used by anything that can be run after all other scripts.
For example, if you want to calculate a field based on the final results of a number of other scripts, that isn't used by anything else, you should use this phase.
|
If you set a number of uses, Hero Lab needs to be able to compare that to the number you've actually used - that means that the Final phase, for scripts that "can be run after all other scripts" is too late.
You do need the final value of the attribute though - that means you need to be in the Post-Attribute phase or later, so, use Post-Attributes as the phase for this script.