Der Code hier müsste theoretisch gehen, für deinen Fall. Aber nur unter der Annahme, dass das Plugin, was du aufrufst, wirklich nur parsedData verwendet und nicht versucht, irgendwas mit text, nextScriptLine oder so zu machen:
Code:
typedef bool __cdecl (*ONCOMMENT_CALLBACK)(const char *, const RPG::ParsedCommentData *, RPG::EventScriptLine *, RPG::EventScriptData *, int, int, int, int *);
HINSTANCE hInstOtherPlugin = GetModuleHandle("name_of_other_plugin");
if(hInstOtherPlugin) {
ONCOMMENT_CALLBACK alienOnComment = GetProcAddress(hInstOtherPlugin, "onComment");
if(alienOnComment) {
RPG::ParsedCommentData fakeCommentData = {0};
strcpy(fakeCommentData.command, "command_to_be_called");
fakeCommentData.parametersCount = 2;
fakeCommentData.parameters[0].type = RPG::PARAM_NUMBER;
fakeCommentData.parameters[0].number = 1234;
fakeCommentData.parameters[1].type = RPG::PARAM_STRING;
strcpy(fakeCommentData.parameters[2].text, "Hello World!");
try {
if(!alienOnComment(NULL, &fakeCommentData, NULL, NULL, 0, 0, 0, NULL)) {
// Yesss! The other plugin seems to have handled our fake request!
} else {
// The other plugin returned true, i.e. it probably didn't handle the request
}
} catch(...) {
// Oops, something crashed - maybe the other plugin tried to access something we didn't provide, such as the event script data
}
} else {
// The other plugin seems not to have an onComment handler...
}
} else {
// The other plugin seems not to be loaded...
}