Fandom

武装突袭 Wiki

Select

简体 | 繁體

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

您使用了广告屏蔽软件!


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

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

Introduced with Operation Flashpoint version 1.00
  

点击图片可看到更多讯息

开始使用于

游戏:
Operation Flashpoint
版本:
1.00

描述

描述:
Selects an element from an array, config entry from Config or substring from a string or a range from an array.

基本句法

句法:
array select index
参数:
array : Array

index: Number - Index 0 denotes the first element, 1 the second, etc. If index has decimal places it gets rounded down for fractions less than or equal .5, otherwise it gets rounded up.
返回值:
Anything

替代句法

句法:
array select boolean
参数:
array : Array

boolean: Boolean - true => 1, false => 0
返回值:
Anything

替代句法2

句法:
config select index
参数:
config : Config

index: Number - Index 0 denotes the first element, 1 the second, etc. If index has decimal places it gets rounded down for fractions less than or equal .5, otherwise it gets rounded up.
返回值:
Config

替代句法3

句法:
string select [start, length]           (since ["Arma 3","Arma3",127,126674,"Development"])
参数:
string: String

[start, length]: Array

start: Number - String position to start selection from. 0 denotes the first character of the string, 1 the second, etc. If passed number has decimal places it gets rounded down for fractions less than or equal .5, otherwise it gets rounded up.

length (optional): Number - Number of the string characters to select. If "length" is omitted, selection will be made from "start" to the end of the string.
返回值:
String

替代句法4

句法:
array select [start, count]           (since ["Arma 3","Arma3",131,127272,"Development"])
参数:
array: Array

[start, count]: Array

start: Number - Array index to start selection from.

count: Number - Number of array elements to select. If the selected range exceeds source array boundaries, selection will be made up to the last element of the array.
返回值:
Array

替代句法5

句法:
array select expression           (since ["Arma 3","Arma3",155,133771,"Development"])
参数:
array: Array

expression: Code - expression that is expected to return Boolean or Nothing. If true is returned, the original array value of currently tested element _x will be added to the output array
返回值:
Array - array of all elements from the original array that satisfied expression condition

范例

范例1:
[1,2,3,4] select 2; //result is 3 position player select 2; //result is Z coordinate of player position

范例2:
["", currentWeapon player] select alive player; //if dead "" is selected

范例3:
(configFile >> "cfgVehicles" >> typeOf vehicle player >> "Turrets") select 0 >> "gunnerAction";

范例4:
hint str ("japa is the man!" select [8]); //the man! hint str ("japa is the man!" select [0,7]); //japa is

范例5:
hint str ([1,2,3,4,5,6] select [1,4]); //[2,3,4,5]

范例6:
_even = [1,2,3,4,5,6,7,8,9,0] select {_x%2 == 0}; // returns [2, 4, 6, 8, 0]

额外资讯

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

selectRandomsetresizereverseinfindtoArraytoStringforEachcountdeleteAtdeleteRangeappendsortparamparamssplitStringjoinStringpushBackpushBackUniqueapply

注意事项

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

Notes

Posted on 3 March 2009
General Barron
When combined with the count command, this can be used to read all entries out of a config; even when you don't know exactly how many entries there will be. See the notes under count for more info.
Posted on 27 Sep, 2013
Killzone_Kid
Rounding of fractions with select is not the same as when you use round command: _roundThis = 0.5; hint str ([0,1] select _roundThis); //0 hint str round _roundThis; //1
Posted on 30 May, 2014 - 1549
ffur2007slx2_5
In ArmA3 ver 1.18, Boolean type supported. Which true defaulted as 1 and false as 0. [0,1] select (56 > 40) // 1 [0,1,2] select ((!isNil "v") && false) // 0

Bottom Section

Posted on June 22, 2015 - 23:23 (UTC)
Killzone Kid
Usually when select tries to pick up element out of range, Arma throws "division by zero" error. However there are exceptions. Basically as long as index of element you are selecting is less then or equal to array size, you will get no error. [] select 0; //ok, result is nil [1,2,3] select 3; //ok, result is nil [1,2,3] select 4; //division by zero

更多维基

随机维基