MGS Sources and Coding page


The mgs.dll scripting engine provides an easy-to-use C++ API through the mgs.hpp header. Without recompiling your own mgs.dll, you can use the binaries provided to interface MGS with your own programs. You only have to implement a few virtual classes, and call the dll exported functions.

You'll get examples in the mgswin and mgsplugin source code. Here is a listing of the exported functions and their usage :

void GetMGSAPIVersion(int & APIVersion,int & DLLVersion,char * & Compile) : Use this to retrieve the version of the DLL, and the version of the API, as well as the compile information string.

void GetMGSScriptInfo(int &,char * p[]) : fills p with the DLL available scripts description. Max script number is given by MAX_MGS_SCRIPTS.

class DataDescriptor * BeginFileScript(char * scriptname,char * output) : is used to initialize file scripting mode. The DLL creates some internal stuff, and gets ready for scripting. It returns a DataDescriptor class, which is a all-purpose class to exchange data between main prog and DLL.

void RunMGS() : Once the DLL is ready, calling this will run the scripts.

void SetPrint(Print_p) : Use this one to redirect the message outputs from the DLL to a custom function. Print_p is any void WINAPI Print(LPCSTR *) function.