Starting out basic before trying with my own program this is what I have done so far.
-Unzipped a fresh ChatScript folder.
-Executed chatscript.exe
-Entered the username “Carlos”
-Entered “:Build 0”
-Entered “:Build Harry” (1 spelling warnings, 0 more serious warnings)
-Closed chatscript.exe
-Placed the “ChatScript.lib” and “lib.h” files you sent me into the main chatscript folder (same place where chatscript.exe is located)
-Created a new test project in Lite-C (in the main chatscript folder) called “testing.c”
The contets of “testing.c” is just the very basic as follows:
#include <acknex.h>
#include "lib.h"
void main()
{
fps_max=60;
level_load(NULL);
InitSystem(NULL,NULL,NULL,NULL,NULL);
while(1)
{
wait(1);
}
}
When I try to run “testing.c” in Lite-C it throws this at me:
Compiling TESTING.C - [Esc] to abort..
Error in ’ ‘lib.h’ line 1:
syntax error
< extern “C” unsigned int InitSystem(int argc, char * argv[],char* unchangedPath = NULL,char* readonlyPath = NULL, char* writablePath = NULL);
>
.. 0.038 sec
Error compiling TESTING.C
I tried commenting that line in lib.h just to see if it had anything to do with argv or the “=NULL” after each parameter since in Lite-C I never use argv or an assignment in function parameters. The second line gives me the same result.
I tried just the functions as if they were not extrenals to test if Lite-C would accept them
#include <acknex.h>
//#include "lib.h"
unsigned int InitSystem(int argc, char * argv[],char* unchangedPath = NULL,char* readonlyPath = NULL, char* writablePath = NULL)
{
}
void PerformChat(char* user, char* usee, char* incoming,char* ip,char* output)
{
}
void main()
{
fps_max=60;
level_load(NULL);
//InitSystem(NULL,NULL,NULL,NULL,NULL);
while(1)
{
wait(1);
}
}
I get the same:
Error in ‘line 4:
syntax error
< unsigned int InitSystem(int argc, char * argv[],char* unchangedPath = NULL,char* readonlyPath = NULL, char* writablePath = NULL)
>
I tried only with the second function:
#include <acknex.h>
//#include "lib.h"
void PerformChat(char* user, char* usee, char* incoming,char* ip,char* output)
{
}
void main()
{
fps_max=60;
level_load(NULL);
//InitSystem(NULL,NULL,NULL,NULL,NULL);
while(1)
{
wait(1);
}
}
and this runs just fine…
So I am guessing it dosnt like extern “C” and something else specific in the InitSystem function prototype
I tried different variations InitSystem to test, removing only the “=NULL” after the parameters, removing only the “char * argv[]”, and removing both.
It only works when removing both.
This runs perfectly withought any errors:
unsigned int InitSystem(int argc,char* unchangedPath,char* readonlyPath, char* writablePath)
{
}
void PerformChat(char* user, char* usee, char* incoming,char* ip,char* output)
{
}
void main()
{
fps_max=60;
level_load(NULL);
//InitSystem(NULL,NULL,NULL,NULL,NULL);
while(1)
{
wait(1);
}
}
So I am pretty sure the problem with the function protype is that Lite-C does not like it if I try to assign something in the parameters themselves, and also does not like the “char * argv[]”.
Besides that, regarding the header file I think Lite-C also has a problem with: extern “C”
I am thinking mabe a solution to the function parameters themselves could be an extra function in the ChatScript.lib itself? Some function as an “in-between step” for me to call in Lite-C with only the last 3 parameters? something that would automatically pass the argv with whatever default values it would need to work… like this mabe:
unsigned int InitSystem_LC(char* unchangedPath,char* readonlyPath, char* writablePath)
{
int argc = whatever?;
char * argv[] = whatever?;
unsigned int result;
result = InitSystem(argc,argv[],unchangedPath,readonlyPath,writablePath);
return(result);
}
That way the header would use this InitSystem_LC function and internally in the lib it would call the InitSystem function.