Ah, making progress now! That all worked for the most part, _Sigma. However, still having a problem with using it...
My game is abstracting all the AS stuff into the ScriptingEngine class. The way I want it to work is as follows: there's one ScriptingEngine object for the entire game; you call Init("script.as") so it loads the script, which will have all the script functions for the entire game; you call Prepare() and SetArgs() and Execute() on the ScriptingEngine object; you gather return values with GetReturnValue(), but more importantly, anything that the script "prints" gets shoved into ScriptingEngine's "output" string, and can be gathered by calling GrabOutput().
Now, my PrintString() function, which is the one that the script uses as "Print()" to print stuff, is a method of ScriptingEngine. Following your example code, I have my app set up as follows:
r = engine->RegisterObjectType("ScriptingEngine", 0, 0); r = engine->RegisterObjectMethod("ScriptingEngine", "void Print(string &str)", asMETHOD(ScriptingEngine,PrintString), asCALL_THISCALL); r = engine->RegisterGlobalProperty("ScriptingEngine engine", (void *)this);
Before adding the last line, I would no longer get the dreaded "ESP" error. The ScriptingEngine couldn't compile my script, however, as I didn't give it a ScriptingEngine object to call Print with. What I need to do is send in "this"; that way, it works according to my design. However, after adding that third line there, I began to receive the ESP error once again. Am I doing it incorrectly, or can you simply not send "this" in as an object for the script to manipulate? If not, I fear my design won't work.
Here's the script, for reference, in case I called it wrong:
void PrintSomething(){ engine.Print("The script is working!");}