script_execute_ext

此函数的工作方式与函数 script_execute 类似,但允许您以 数组 的形式传递函数 / 脚本所需的参数。

您还可以向函数传递两个可选参数,以指定要从中获取参数的数组的偏移量,以及要从数组中使用的参数数量 (这必须是 array_length - 偏移量的最大值)。

 

语法:

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

参数类型描述
scrScript Asset or Script Function要调用的函数/脚本
array_argsArray可选 包含函数 / 脚本参数的数组。如果函数 / 脚本不带参数,则可以省略。
[offset]Real可选 参数数组的偏移量
[num_args]Real可选 要使用的参数数(从偏移量开始)

 

返回:

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

 

例子:

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

上面的示例代码将使用 script_execute_ext 调用给定函数,提供四个参数的数组,但随机仅使用其中一个参数。