My Project
|
ParaGlobal namespace contains a list of HAPI functions to globally control the engine. More...
#include <ParaScriptingGlobal.h>
Static Public Member Functions | |
static void | ExitApp () |
exit the applications. | |
static void | Exit (int nReturnCode) |
This is same as ExitApp, except that it supports a return code. More... | |
static void | SelectAttributeObject (const ParaAttributeObject &obj) |
select a given attribute object. More... | |
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. More... | |
static const char * | GetLog (int fromPos, int nCount) |
get log text between two Log positions. More... | |
static ParaServiceLogger | GetLogger (const object &name) |
Get a service logger. More... | |
static ParaServiceLogger | GetLogger_ (const char *name) |
static bool | WriteToFile (const char *filename, const char *strMessage) |
write const char* to specific file. More... | |
static void | SetGameStatus (const char *strState) |
set the game status More... | |
static double | GetGameTime () |
static std::string | GetDateFormat (const object &sFormat) |
get the date in string [thread safe] More... | |
static std::string | GetTimeFormat (const object &sFormat) |
get the time in string [thread safe] More... | |
static DWORD | timeGetTime () |
The timeGetTime function retrieves the system time, in milliseconds. More... | |
static double | getAccurateTime () |
get the elapsed time using high-resolution timing function in seconds. More... | |
static double | random () |
the random seed is set at application start More... | |
static double | GetSysDateTime () |
Get the system date and time in seconds. More... | |
static std::string | GenerateUniqueID () |
generate a unique ID as a string. More... | |
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. More... | |
static object | LoadObject (const object &strObjectName) |
global object dictionary functions: this is a way for different script runtime to share some global information. More... | |
static void | SetGameLoop (const char *scriptName) |
reset the game loop script. More... | |
static void | SetGameLoopInterval (float fInterval) |
set the game loop activation interval. More... | |
static bool | CreateProcess (const char *lpApplicationName, const char *lpCommandLine, bool bWaitOnReturn) |
run an external application. More... | |
static bool | ShellExecute (const char *lpOperation, const char *lpFile, const char *lpParameters, const char *lpDirectory, int nShowCmd) |
Performs an operation on a specified file. More... | |
static bool | OpenFileDialog (const object &inout) |
create a open file dialog. More... | |
static bool | WriteRegStr (const string &root_key, const string &sSubKey, const string &name, const string &value) |
Write a string to the registry. More... | |
static const char * | ReadRegStr (const string &root_key, const string &sSubKey, const string &name) |
Read string from the registry. More... | |
static bool | WriteRegDWORD (const string &root_key, const string &sSubKey, const string &name, DWORD value) |
Write a DWORD to the registry. More... | |
static DWORD | ReadRegDWORD (const string &root_key, const string &sSubKey, const string &name) |
Read DWORD from the registry. More... | |
ParaGlobal namespace contains a list of HAPI functions to globally control the engine.
|
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. |
|
static |
This is same as ExitApp, except that it supports a return code.
this is the recommended way of exiting application. this is mainly used for writing test cases. Where a return value of 0 means success, any other value means failure.
|
static |
generate a unique ID as a string.
This is usually a string. [thread safe]
|
static |
get the elapsed time using high-resolution timing function in seconds.
this function is mostly used for profiling on the NPL
|
static |
get the date in string [thread safe]
sFormat | can be NULL to use default.e.g. "ddd',' MMM dd yy"
|
|
static |
|
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. |
|
static |
Get a service logger.
Please see util/LogService.h for more information.
|
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.
|
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. [thread safe]
|
static |
get the time in string [thread safe]
sFormat | can be NULL to use default. e.g. "hh':'mm':'ss tt"
|
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
|
static |
create a open file dialog.
This function does not return until the user selects a dialog.
inout | input table:{filter="All Files (*.*);*.*;", filterindex, initialdir, flags, } t.filter="All Files (*.*)\0*.*\0" output : {filename, result=true} t.filename: the full path and file name specified by the user t.result: boolean if user clicks the OK button |
|
static |
the random seed is set at application start
|
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 |
|
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 |
|
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.
|
static |
select a given attribute object.
this is a static function
|
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
|
static |
set the game loop activation interval.
The default value is 0.5 seconds.
|
static |
set the game status
strState |
|
|
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.
|
|
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.
|
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 |
|
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 |
|
static |
write const char* to specific file.
obsolete