I'm trying to write a MM:S plugin that extends the Vscript scripting interface in CS:GO. But I'm running into this problem, I can't get IScriptVM->LookupFunction() to return anything except NULL.
If you look here in the SDK, you'll see this example:
Code:
// Generally, use the "Call" functions. This example is the equivalent of DoIt("Har", 6.0, 99).
hFunction = pScriptVM->LookupFunction( "DoIt", hScope );
pScriptVM->Call( hFunction, hScope, true, NULL, "Har", 6.0, 99 );
Now some of my test code looks something like this:
Code:
void VpTestScriptFunctionCall() {
HSCRIPT func = g_mScriptVM->LookupFunction("ScriptPrintMessageChatAll");
g_mScriptVM->Call(func, NULL, true, NULL, "It works!");
}
But after a little bit of debugging I realized that `g_mScriptVM->LookupFunction` was always returning NULL, I tried giving it a scope(even though that's an optional argument), I tried giving it a function name that I added through "ScriptRegisterFunction", and I tried giving it a function listed in the
CS:GO Vscript Documentation, none of that seemed to have helped, it still just returns NULL. Does anyone have any ideas how I can get LookupFunction to do anything? ...or does this just seem to be a problem with the SDK?
(Just in case anyone is interested, I'm getting my instance of IScriptVM by hooking CreateVM in IScriptManager.)