Execute the script with index scr with the given arguments


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

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

Returns: Will depend on the return value from the script being called.


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 Advanced Use: Scripts. If the script has a return value, then this function will also return that value when called.


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.

Back: Miscellaneous
Next: gml_release_mode
© Copyright YoYo Games Ltd. 2018 All Rights Reserved