Jump to content

(SKSE Plugin) Getting a return value of Papyrus function


Recommended Posts

Posted

Hi!

 

I'm making a SKSE plugin using CommonLibSSE NG and stumbled upon a problem. I need to call a Papyrus function from the plugin and get its return value. I'm using "DispatchStaticCall" and "DispatchMethodCall", and it seems to work - Papyrus functions are being called. But I can't understand how to extract return value from "IStackCallbackFunctor". When I try to convert it to RE::BSScript::Variable using "operator()" game crashes. Is there a working example of how to use IStackCallbackFunctor?

 

That's the code I'm running

 

RE::BSTSmartPointer<RE::BSScript::IStackCallbackFunctor> CallBack;
auto args2 = RE::MakeFunctionArguments(std::move(nullptr));
auto vm = RE::BSScript::Internal::VirtualMachine::GetSingleton();
RE::BSFixedString SomeString = "SomeFunction";
vm->DispatchMethodCall(SomeObject, SomeString, args2, CallBack);

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...