How to pass data/variable from Blueprint to SkookumScript


#1

In blueprint, I have a variable “Age” which could I pass the value of “Age” to SkookumScript?


Calling into SkookumScript directly from C++
#2

We have currently integrated only a limited amount of communication between SkookumScript and Blueprints.

Here is how to call SkookumScript from Blueprints currently using a SkookumScriptComponent without adding any extra C++ code in the plugin.

As it mentions on that page - invoke_coroutine(), invoke_method() and invoke_query() do not currently take arguments.

Adding the capability to pass arguments is fairly straightforward and will be added to the plugin and expanded significantly in a future update.

Call SkookumScript with args from Blueprints - doing it yourself with C++

If you are keen and willing to play with the C++ code of the plugin – you can add the ability to call a SkookumScript routine with one or more parameters yourself.

Take a look at USkookumScriptComponent::invoke_method() for an example that has no arguments.

Passing in an integer argument would look something like this:

void USkookumScriptComponent::invoke_method_with_int(FString name, int32 IntValue)
  {
  m_instance_p->method_call(FStringToASymbol(name), SSInteger::as_instance(IntValue));
  }

Or just wait for a future update when we will have a more comprehensive SkookumScript<->Blueprints mechanism.


#3

Thanks Noolarch!

i’m afraid “invoke_method_with_int” route might quickly become unmanageable when different method signatures come to play.

I added get_<data_type>by_name and set<data_type>_by_name methods to the SkookumScriptComponent to pass simple data from blueprint to SkookumScript for now.

Ideally those data members should be exposed in blueprint editor UI for easy manipulation, like the ScriptPlugin example did:

But even with that, we still lack SkookumScript->Blueprint interaction. Is there timeline/plan for the full SkookumScript<->Blueprints mechanism implemented?


#4

I totally agree - especially the unmanageable part.

Sk->BP and BP->Sk communication has a white-hot priority for the next update.

One mechanism that would work is to take an arbitrary sized list as a set of arguments - however this would be error prone since it would not be type-checked and cumbersome as well. We also might be able to just populate the list of known BP functions with all the SkookumScript functions - though that might explode the number of calls.

We are obviously still in the research and discovery phase of how to best implement this. So once our plan is more clear we can give an update on an ETA. Rest assured though - we believe it is critical and we are working on it.