script_execute

This function was originally designed for calling script assets in a dynamic way, but with the introduction of user-defined functions it can now be used in two ways:

NOTE While this function is designed primarily for legacy support, it is not deprecated as it still has its place in networking and remote procedure call situations. It is also worth noting that this function is slow, and using it a lot may adversely affect performance.

 

Syntax:

script_execute(scr, arg0, arg1, arg2, etc.);

ArgumentTypeDescription
scrScript Asset or Script FunctionThe function/script that you want to call
arg0, arg1, arg2, etc.AnyThe different arguments that you want to pass through to the function/script

 

Returns:

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

 

Example:

script_execute(choose(move_up, move_down, move_left, move_right), irandom(5));

The above example code will use script_execute to choose one of four user defined functions (in this case related to movement) and pass a random integer to it as the first argument.