Fandom

武装突袭 Wiki

Param

简体 | 繁體

4,827个页面创建
于此维基上
添加新页面
评论0 Share

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

Introduced with Arma 3 version 1.48
  

点击图片可看到更多讯息

开始使用于

游戏:
Arma 3
版本:
1.48

描述

描述:
Extracts a single value with given index from input argument, similar to BIS_fnc_param. When used without argument, as shown in main syntax, internal variable _this, which is usually available inside functions and event handlers, is used as argument. If input argument is not an array, it will be converted to 1 element array.

If extracted item of input with given index is undefined, of the wrong type or of the wrong length (if the item is an array), default value is used instead. Since Arma 3 v1.53.132691, onscreen errors are displayed for when the input is of the wrong type or size.

基本句法

句法:
param [index, defaultValue, expectedDataTypes, expectedArrayCount]
参数:
[index, defaultValue, expectedDataTypes, expectedArrayCount]: Array

index: Number - index of required item in the input array.

defaultValue (Optional): Anything - a default value to return if input is undefined, of the wrong type or of the wrong length (if the item is an array).

expectedDataTypes (Optional): Array of direct Data Types - checks if passed value is one of listed Data Types. If not, default value is used instead. Empty array [] means every data type is accepted.

expectedArrayCount (Optional): Number or Array - a single size or array of sizes. If passed input value is an array, checks that it has a certain number of elements. If not, default value is used instead. Empty array [] means any size is accepted.
返回值:
Anything - extracted value on success or default value otherwise. Nothing if syntax error occurred.

替代句法

句法:
argument param [index, defaultValue, expectedDataTypes, expectedArrayCount]
参数:
argument: Anything - A usual array of params is expected. If a non-array value is passed, it will be converted to 1 element array

[index, defaultValue, expectedDataTypes, expectedArrayCount]: Array

index: Number - index of required item in the input array.

defaultValue (Optional): Anything - a default value to return if input is undefined, of the wrong type or of the wrong length (if the item is an array).

expectedDataTypes (Optional): Array of direct Data Types - checks if passed value is one of listed Data Types. If not, default value is used instead. Empty array [] means every data type is accepted.

expectedArrayCount (Optional): Number or Array - a single size or array of sizes. If passed input value is an array, checks that it has a certain number of elements. If not, default value is used instead. Empty array [] means any size is accepted.
返回值:
Anything - extracted value on success or default value otherwise. Nothing if syntax error occurred.

范例

范例1:
[1, 2, 3] call { private ["_one", "_two", "_three"]; _one = param [0, 1]; _two = param [1, 2]; _three = param [2, 3]; // ..... };

范例2:
[123] call { private "_val"; _val = param [0]; };

// Below would produce the same result as above 123 call { private "_val"; _val = param [0]; };

范例3:
_z = position player param [2, 0]; if (_z > 10) then { hint "YOU ARE FLYING!"; };

范例4:
fnc = { private ["_pos", "_rad"] _pos = param [0, [0,0,0], [objNull, []], [2,3]]; _rad = param [1, 0, [0]]; _pos nearObjects _rad; };

[position player, 25] call fnc; //ok [player, 25] call fnc; //ok [25, player] call fnc; //default values are used

额外资讯

多人游戏:
-
也可以看看:

paramsselectsetresizereverseinfindtoArraytoStringforEachcountdeleteAtdeleteRangeappendsortarrayIntersectsplitStringjoinStringisEqualTypeAllisEqualTypeisEqualTypeParamsisEqualTypeArrayisEqualTypeAnytypeNameBIS_fnc_param

注意事项

此处撰写句法皆为可行用法. 可到官网[1]专页回报错误. 你可以使用讨论页面或是论坛来进行讨论.
新增注意事项 | 如何新增?

更多维基

随机维基