mortic::IScriptManager* sm = root->getScriptManager();
Once you have the script manager, you can create individual scripts through two functions. One creates a Python script from a string:
mortic::IScript* s = sm->createScriptFromString("def print_hello():\n\tprint \"Hello!\"\n");
mortic::IScript* s = sm->createScript("/print_hello.py");
s->runSimpleString("print_hello()\n");
Another function that is almost as simple is variableExists():
if (s->variableExists("someVar")) ...
s->callFunction("print_hello", "");
s->callFunction("printVars", "i", 42);
Let's assume that printVars() is a simple Python function that prints out each of it's arguments on it's own line. This could be written in python as:
def printVars(*args): for i in args: print i
So, the example above would print out 42. Let's look closer at this function. The first argument is the name of the function to call. This much is obvious. However, the rest of the arguments work a bit like the C function printf(). The second argument is the format string. Every letter in this string corresponds to an argument. If the letter is "i", it's an integer. If it's "b", it's a boolean. Finally, if it's a "f", it's a float. Now, let's test something...
s->callFunction("printVars", "bif", true, 42, 13.37);
s->callFunction("printVars", "b<FileManager>if", true, root->getFileManager(), 42, 13.37);