namespace ParaEngine


int my_rand()
class IObjectScriptingInterface

Public Functions

bool AddScriptCallback(int func_type, const string &script_func)

add a new call back handler. it will override the previous one if any.

  • script_func: format is [filename];[scode] where file name can be any NPL address, scode is a short code sequence to execute. it may has the same format as the GUI event handler. e.g. ”;function1()” : calling a global function “(gl)script/character/npc.lua;npc.on_click()” : load script if not loaded before and then calling a global function if this is “”, RemoveScriptCallback() will be called.

IObjectScriptingInterface::ScriptCallback *GetScriptCallback(int func_type)

return NULL if there is no associated script.

bool RemoveScriptCallback(int func_type)

remove a call back handler

struct ScriptCallback
#include <IObjectScriptingInterface.h>

the game object will keep a list of script call backs.

Public Functions

void SetScriptFunc(const std::string &script)

set the script function

int ActivateAsync(const std::string &code)

activate the script callback with the given code.

int ActivateLocalNow(const std::string &script)

activate the script callback locally now. when function returns, the script has returned.

Public Members

int func_type

function type

std::string script_func

the NPL file and function to be activated. Its format is similar to GUI events. e.g. “(gl)script/NPC1.lua;NPC1.On_Click();”

unsigned int m_nLastTick

last time this function is called.