Arbitrary param count for Conditions & Actions?

For developers using the Construct 2 Javascript SDK

Post » Mon Apr 13, 2015 5:10 am

Is there an official way to make Conditions and Actions with unlimited params (variadic)?

I know Expressions have the "ef_variadic_parameters" flag.
And the Function object uses the "AddVariadicParams()" method for the "Call Function" Action, but I'm not sure if this method is for the Function object only, or if it's okay for general use in 3rd-party plugins.

So, I'm curious if there is an official way to do this for Conditions and Actions.
Thanks in advance for any info or suggestions. :)
B
26
S
17
G
8
Posts: 322
Reputation: 6,017

Post » Mon Apr 13, 2015 8:10 am

See the source code of official function plugin, line 172, line 260.
B
107
S
25
G
243
Posts: 4,387
Reputation: 137,466

Post » Mon Apr 13, 2015 1:24 pm

Thanks for the reply Rex, :)

I looked over the Function runtime code.
So it looks like "AddVariadicParams()" is passed as an array to the corresponding runtime function single parameter.

Is it okay to use it for Plugins and Behaviors?

Ashley mentioned in an older post that it was a hack for the Function object, and was not recommended for use in 3rd party plugins. Granted, he said that was not recommended, 'for the time being', and that was back in 2012.

Do you know off hand if whatever limitations that existed then are no longer an issue?

The plugin I'm working on would ideally be usable as a behavior.
B
26
S
17
G
8
Posts: 322
Reputation: 6,017

Post » Mon Apr 13, 2015 2:22 pm

@fisholith

Behavior does not support AddVariadicParams(). You might add an action to push a parameter, so that user could call it many times to have a parameter array.
B
107
S
25
G
243
Posts: 4,387
Reputation: 137,466


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests