Syntax Error Driving Me Nuts [fixed]

I have a large library that I have written (1500+ lines including a lot of comments). I have got rid of a few syntax errors and prevented a few more when I discovered that NwN doesn’t like the float literal 1f instead insisting on 1.0f (what’s the point of the bleeping ‘f’ then?). That threw up the infamous “ERROR: NO SEMICOLON AFTER EXPRESSION” as the error message BTW.

But now I am getting the same error message on a totally different line and I can’t see why. In the following snippet it is the last line that throws the error -

    fTempY = vTemp.y - vRotationPoint.y;
    fTempZ = vTemp.z - vRotationPoint.z;

    fNewY = fTempY * fC + fTempZ * fS;
    fNewZ = fTempZ * fC – fTempY * fS; // ERROR: NO SEMICOLON AFTER EXPRESSION

As you can see all lines are terminated with semi-colons and there are no brackets - neither ( or ) - in sight (something that according to the online lexicon can also make this error fire). In fact I can’t see what the problem is. In case it’s relevant, the line number that throws the error is 1103 and that comment doesn’t exist in the actual code.

If someone can figure out what is wrong please let me know preferably before I go bald from pulling my hair out. Thanks.

TR

Your minus sign on that last line is not a hyphen.

The error is more or less what the in box compiler uses for general syntax error. I.e. can’t parse.

As to the “f”… it is not needed (and, I find, annoying). Just use 1.0.

Thanks for that. Seems you’ve better eyesight than I have. That fixed it. There were other errors found after that but I was expecting such. Finally got it to compile now comes the harder part - getting it to actually work!

Thanks again.

TR

I doubt it’s eyesight, mine’s getting progressively worse now that I turned 39 for the 12th time :slight_smile:

I cut and pasted your code into a script, fixed up the declarations and ran it through my compiler. That said:

x.nss(13): Error: Syntax error at “fTempY”

which got me close enough to really see how wide that dash was.

1 Like

If error messages don’t make sense, there is an easy method to point the culprit. As Nwn compiler allows to break an expression in as many lines as you want. You can use one symbol or instruction per line to pinpoint where the error message is located. Using something like:

fNewZ

=
fTempZ
*
fC
_
fTempY
*
fS
;

would give an error line pointing the pseudo-minus symbol as culprit, and knowing the culpable is at least half solving the problem.

PS. You don’t need the extra line below fNewZ, its just that if i don’t add it, the forum persist in using bold with my text…

1 Like