Cannot get Script IF statement to compile
Posted: Fri 8. Oct 2010, 19:52
Every IF statement in my scripts gets a compiler error saying it expected a ';' after the IF statement.
The following generates that error:
void test()
{
IF( 1 == 2 )
{
ShowTraceWin(true);
Trace(" 1 = 2 is TRUE" + "...\n");
}
}
The following trace is produced:
C:\_STOCKMODELSmb\01Preliminary\test.as
C:\_STOCKMODELSmb\01Preliminary\test.as (1, 1) : INFO : Compiling void test()
C:\_STOCKMODELSmb\01Preliminary\test.as (4, 2) : ERR : Expected ';'
1 Error(s).
0 Warning(s):
If I put the ';' where they want it (which is absurd), I get:
Compiling Script:
C:\_STOCKMODELSmb\01Preliminary\test.as
C:\_STOCKMODELSmb\01Preliminary\test.as (1, 1) : INFO : Compiling void test()
C:\_STOCKMODELSmb\01Preliminary\test.as (3, 2) : ERR : No matching signatures to 'IF(const bool)'
1 Error(s).
0 Warning(s):
_______________________________________________________
Having programmed in UNIX, this almost suggests that my script is not being interpreted as Angelscript.
I am pretty much at wits end on this one.
Thanks in advance,
Tom
========================================================================================
EDIT:
Looks like there is an issue with the filetype used for the script.
If I cut and past the code from ErrorCheck.as into my test.as file, it compiles.
If I type those statements, it produces the error.
I am going to scrutinize both files with a hex editor to see what the difference is.
It could be as simple as the handling of the CR and LF at each line end.
I did try saving Notepad text file as ANSI, Unicode, and UTF-8 (i think) and that made no difference.
The following generates that error:
void test()
{
IF( 1 == 2 )
{
ShowTraceWin(true);
Trace(" 1 = 2 is TRUE" + "...\n");
}
}
The following trace is produced:
C:\_STOCKMODELSmb\01Preliminary\test.as
C:\_STOCKMODELSmb\01Preliminary\test.as (1, 1) : INFO : Compiling void test()
C:\_STOCKMODELSmb\01Preliminary\test.as (4, 2) : ERR : Expected ';'
1 Error(s).
0 Warning(s):
If I put the ';' where they want it (which is absurd), I get:
Compiling Script:
C:\_STOCKMODELSmb\01Preliminary\test.as
C:\_STOCKMODELSmb\01Preliminary\test.as (1, 1) : INFO : Compiling void test()
C:\_STOCKMODELSmb\01Preliminary\test.as (3, 2) : ERR : No matching signatures to 'IF(const bool)'
1 Error(s).
0 Warning(s):
_______________________________________________________
Having programmed in UNIX, this almost suggests that my script is not being interpreted as Angelscript.
I am pretty much at wits end on this one.
Thanks in advance,
Tom
========================================================================================
EDIT:
Looks like there is an issue with the filetype used for the script.
If I cut and past the code from ErrorCheck.as into my test.as file, it compiles.
If I type those statements, it produces the error.
I am going to scrutinize both files with a hex editor to see what the difference is.
It could be as simple as the handling of the CR and LF at each line end.
I did try saving Notepad text file as ANSI, Unicode, and UTF-8 (i think) and that made no difference.