void MyScriptFunction(FunctionContext* context) { int x = context->GetInt(0); int y = context->GetInt(1); int z = x + y; context->SetIntReturnValue(z); }
void MyOtherScriptFunction(FunctionContext* context) { NWN::CNWSObject* object = context->GetObject(0); object->AddToJournal("Hello World!", NWN::OBJECT_INVALID, false); }This example demonstrates how the FunctionContext can be used to pass an object into a script function and then perform an operation on that object. In this case, the script function adds a journal entry to the object passed in using the AddToJournal method. The cpp aurora.nwscript package library is part of the Neverwinter Nights video game engine.