script_execute_ext

This function works similarly to the function script_execute but allows you to pass the arguments required for the function/script as an array.

You can also pass two optional arguments to the function to specify an offset into the array to get the arguments from, as well as the number of arguments to use from the array (this must be a maximum of array_length - offset).

 

Syntax:

script_execute_ext(scr, [array_args], [offset], [num_args]);

ArgumentTypeDescription
scrScript Asset or Script FunctionThe function/script that you want to call
array_argsArrayOPTIONAL The array containing the arguments for the function/script. Can be omitted if the function/script takes no arguments.
[offset]RealOPTIONAL The offset into the argument array
[num_args]RealOPTIONAL The number of arguments to use (from the offset onwards)

 

Returns:

Any (Will depend on the return value from the function/script being called)

 

Example:

script_execute_ext(move_inst, move_array, floor(random(4)), 1);

The above example code will use script_execute_ext to call the given function, supplying an array of four arguments, but only using one of them at random.