Static Public Member Functions | |
static void | ExitApp () |
exit the applications. | |
static void | WriteToConsole (const char *strMessage) |
write const char* to console, usually for debugging purposes. | |
static void | WriteToLogFile (const char *strMessage) |
write const char* to log file, usually for debugging purposes. | |
static int | GetLogPos () |
get the current log file position. | |
static const char * | GetLog (int fromPos, int nCount) |
get log text between two Log positions. | |
static bool | WriteToFile (const char *filename, const char *strMessage) |
write const char* to specific file. | |
static void | SetGameStatus (const char *strState) |
set the game status | |
static double | GetGameTime () |
| |
static const char * | GetDateFormat (const char *sFormat) |
get the date in string | |
static const char * | GetTimeFormat (const char *sFormat) |
get the time in string | |
static DWORD | timeGetTime () |
The timeGetTime function retrieves the system time, in milliseconds. | |
static double | random () |
the random seed is set at application start | |
static double | GetSysDateTime () |
Get the system date and time in seconds. | |
static const char * | GenerateUniqueID () |
generate a unique ID as a string. | |
static void | SaveObject (const char *strObjectName, const object &objObject) |
global object dictionary functions: this is a way for different script runtime to share some global information. | |
static object | LoadObject (const object &strObjectName) |
global object dictionary functions: this is a way for different script runtime to share some global information. | |
static void | SetGameLoop (const char *scriptName) |
reset the game loop script. | |
static void | SetGameLoopInterval (float fInterval) |
set the game loop activation interval. | |
static bool | CreateProcess (const char *lpApplicationName, const char *lpCommandLine, bool bWaitOnReturn) |
run an external application. | |
static bool | ShellExecute (const char *lpOperation, const char *lpFile, const char *lpParameters, const char *lpDirectory, int nShowCmd) |
Performs an operation on a specified file. | |
static bool | WriteRegStr (const string &root_key, const string &sSubKey, const string &name, const string &value) |
Write a string to the registry. | |
static const char * | ReadRegStr (const string &root_key, const string &sSubKey, const string &name) |
Read string from the registry. | |
static bool | WriteRegDWORD (const string &root_key, const string &sSubKey, const string &name, DWORD value) |
Write a DWORD to the registry. | |
static DWORD | ReadRegDWORD (const string &root_key, const string &sSubKey, const string &name) |
Read DWORD from the registry. |
int ParaScripting::ParaGlobal::GetLogPos | ( | ) | [static] |
get the current log file position.
it is equivalent to the log file size in bytes. one can later get log text between two Log positions.
const char * ParaScripting::ParaGlobal::GetLog | ( | int | fromPos, | |
int | nCount | |||
) | [static] |
get log text between two Log positions.
fromPos,: | position in bytes. if nil, it defaults to 0 | |
nCount,: | count in bytes. if nil, it defaults to end of log file. |
bool ParaGlobal::WriteToFile | ( | const char * | filename, | |
const char * | strMessage | |||
) | [static] |
write const char* to specific file.
obsolete
void ParaGlobal::SetGameStatus | ( | const char * | strState | ) | [static] |
set the game status
strState,: |
|
double ParaGlobal::GetGameTime | ( | ) | [static] |
this is usually used for cinematic movies
const char * ParaScripting::ParaGlobal::GetDateFormat | ( | const char * | sFormat | ) | [static] |
get the date in string
sFormat,: | can be NULL to use default.e.g. "ddd',' MMM dd yy"
|
const char * ParaScripting::ParaGlobal::GetTimeFormat | ( | const char * | sFormat | ) | [static] |
get the time in string
sFormat,: | can be NULL to use default. e.g. "hh':'mm':'ss tt"
|
DWORD ParaScripting::ParaGlobal::timeGetTime | ( | ) | [static] |
The timeGetTime function retrieves the system time, in milliseconds.
The system time is the time elapsed since Windows was started. Note that the value returned by the timeGetTime function is a DWORD value. The return value wraps around to 0 every 2^32 milliseconds, which is about 49.71 days. This can cause problems in code that directly uses the timeGetTime return value in computations, particularly where the value is used to control code execution. You should always use the difference between two timeGetTime return values in computations.
double ParaScripting::ParaGlobal::random | ( | ) | [static] |
the random seed is set at application start
double ParaScripting::ParaGlobal::GetSysDateTime | ( | ) | [static] |
Get the system date and time in seconds.
The system time is expressed in Coordinated Universal Time (UTC). Note: there is some trick to make the returned value a valid number in NPL. Only compare time with time returned by the same function. TODO: in the long run, a true unsigned int64 should be returned.
const char * ParaScripting::ParaGlobal::GenerateUniqueID | ( | ) | [static] |
generate a unique ID as a string.
This is usually a string.
void ParaGlobal::SaveObject | ( | const char * | strObjectName, | |
const object & | objObject | |||
) | [static] |
global object dictionary functions: this is a way for different script runtime to share some global information.
Currently only value and const char* object can be saved. one can save nil to a object name to delete the object.
objObject,: | object to save |
already exists, then override old value
already exists, then override old value
already exists, delete it.
object ParaGlobal::LoadObject | ( | const object & | strObjectName | ) | [static] |
global object dictionary functions: this is a way for different script runtime to share some global information.
Currently only value and const char* object can be saved. return nil, if object is not found
strObjectName,: | the object name |
get object from dictionary table
void ParaGlobal::SetGameLoop | ( | const char * | scriptName | ) | [static] |
reset the game loop script.
the game loop script will be activated every 0.5 seconds see SetGameLoopInterval() to change the default interval Please keep the game loop concise. The default game loop is ./script/gameinterface.lua
void ParaGlobal::SetGameLoopInterval | ( | float | fInterval | ) | [static] |
set the game loop activation interval.
The default value is 0.5 seconds.
bool ParaGlobal::CreateProcess | ( | const char * | lpApplicationName, | |
const char * | lpCommandLine, | |||
bool | bWaitOnReturn | |||
) | [static] |
run an external application.
creates a new process and its primary thread. The new process runs the specified executable file in the security context of the calling process.
lpApplicationName:Pointer | to a null-terminated string that specifies the module to execute. The specified module can be a Windows-based application. The string can specify the full path and file name of the module to execute or it can specify a partial name. In the case of a partial name, the function uses the current drive and current directory to complete the specification. The function will not use the search path. If the file name does not contain an extension, .exe is assumed. If the executable module is a 16-bit application, lpApplicationName should be NULL, and the string pointed to by lpCommandLine should specify the executable module as well as its arguments. | |
lpCommandLine:Pointer | to a null-terminated string that specifies the command line to execute. | |
bWaitOnReturn,: | if false, the function returns immediately; otherwise it will wait for the editor to return. if this is true, the Child Process will have Redirected Input and Output to current log file. |
bool ParaGlobal::ShellExecute | ( | const char * | lpOperation, | |
const char * | lpFile, | |||
const char * | lpParameters, | |||
const char * | lpDirectory, | |||
int | nShowCmd | |||
) | [static] |
Performs an operation on a specified file.
e.g. ParaGlobal.ShellExecute("open", "iexplore.exe", "http://www.paraengine.com", nil, 1);
lpOperation:[in] | Pointer to a null-terminated string,
| |
lpFile | [in] Pointer to a null-terminated string that specifies the file or object on which to execute the specified verb. To specify a Shell namespace object, pass the fully qualified parse name. Note that not all verbs are supported on all objects. For example, not all document types support the "print" verb. | |
lpParameters[in] | If the lpFile parameter specifies an executable file, lpParameters is a pointer to a null-terminated string that specifies the parameters to be passed to the application. The format of this string is determined by the verb that is to be invoked. If lpFile specifies a document file, lpParameters should be NULL. | |
lpDirectory | [in] Pointer to a null-terminated string that specifies the default directory. | |
nShowCmd,: | [in] Flags that specify how an application is to be displayed when it is opened. If lpFile specifies a document file, the flag is simply passed to the associated application. It is up to the application to decide how to handle it.
|
bool ParaScripting::ParaGlobal::WriteRegStr | ( | const string & | root_key, | |
const string & | sSubKey, | |||
const string & | name, | |||
const string & | value | |||
) | [static] |
Write a string to the registry.
e.g. WriteRegStr("HKLM", "Software\My Company\My Software", "String Value", "String Name");
root_key,: | must be HKCR or HKEY_CLASSES_ROOT HKLM or HKEY_LOCAL_MACHINE HKCU or HKEY_CURRENT_USER HKU or HKEY_USERS |
const char * ParaScripting::ParaGlobal::ReadRegStr | ( | const string & | root_key, | |
const string & | sSubKey, | |||
const string & | name | |||
) | [static] |
Read string from the registry.
Valid values for root_key are listed under WriteRegStr. NULL will be returned if the string is not present. If the value is present, but is of type REG_DWORD, it will be read and converted to a string.
root_key,: | must be HKCR or HKEY_CLASSES_ROOT HKLM or HKEY_LOCAL_MACHINE HKCU or HKEY_CURRENT_USER HKU or HKEY_USERS |
bool ParaScripting::ParaGlobal::WriteRegDWORD | ( | const string & | root_key, | |
const string & | sSubKey, | |||
const string & | name, | |||
DWORD | value | |||
) | [static] |
Write a DWORD to the registry.
see WriteRegStr() for more info
root_key,: | must be HKCR or HKEY_CLASSES_ROOT HKLM or HKEY_LOCAL_MACHINE HKCU or HKEY_CURRENT_USER HKU or HKEY_USERS |
DWORD ParaScripting::ParaGlobal::ReadRegDWORD | ( | const string & | root_key, | |
const string & | sSubKey, | |||
const string & | name | |||
) | [static] |
Read DWORD from the registry.
Valid values for root_key are listed under WriteRegStr. NULL will be returned if the DWORD is not present or type is a string.
root_key,: | must be HKCR or HKEY_CLASSES_ROOT HKLM or HKEY_LOCAL_MACHINE HKCU or HKEY_CURRENT_USER HKU or HKEY_USERS |