script_execute


Description

There are times that you may want to pass a script to an instance in a dynamic way, and for these cases we provide the script_execute function. It will run a user created script resource and pass up to 15 arguments to that script. For more information about scripts, see Scripts.


Syntax:

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

Argument Description
scr The ID of the script that you want to call
arg0 ... arg14 The different arguments that you want to pass through to the script


Returns:

N/A


Example:

script_execute(choose(scr_Up, scr_Down, scr_Left, scr_Right), irandom(5));

The above example code will use script_execute to choose one of four user created script resources (in this case related to movement) and pass a random integer to it as argument0.