select: Difference between revisions
Jump to navigation
Jump to search
m (Text replace - "{{uc:{{PAGENAME}}}}" to "{{uc:{{PAGENAME}}}} {{uc:{{PAGENAME}}}}") |
Killzone Kid (talk | contribs) No edit summary |
||
Line 10: | Line 10: | ||
Index 0 denotes the first element, 1 the second, etc.<br> | Index 0 denotes the first element, 1 the second, etc.<br> | ||
If index has decimal places it gets rounded down for fractions less than .5, otherwise it gets rounded up. |= Description | If index has decimal places it gets rounded down for fractions less than or equal .5, otherwise it gets rounded up. |= Description | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 47: | Line 47: | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on 3 March 2009 | |||
<dt class="note">'''[[User:General Barron|General Barron]]'''<dd class="note"> | |||
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. | 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. | ||
<dd class="notedate">Posted on 27 Sep, 2013 | |||
<dt class="note">'''[[User:Killzone_Kid|Killzone_Kid]]'''<dd class="note">Rounding of fractions with [[select]] is not the same as when you use [[round]] command: | |||
<code>_roundThis = 0.5; | |||
[[hint]] [[str]] ([0,1] [[select]] _roundThis); //0 | |||
[[hint]] [[str]] [[round]] _roundThis; //1</code> | |||
<!-- Note Section END --> | <!-- Note Section END --> |
Revision as of 23:53, 27 September 2013
Description
- Description:
- Selects an index element of an array or config object.
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. - Groups:
- Uncategorised
Syntax
Alternative Syntax
Examples
- Example 1:
[1,2,3,4] select 2
- result is 3- Example 2:
position player select 2
- result is Z coordinate of player position (see Position for more details)- Example 3:
(configFile >> "CfgVehicles") select 0
Additional Information
- See also:
- count
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
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
Bottom Section
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint version 1.00
- Operation Flashpoint: New Scripting Commands
- Operation Flashpoint: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands OFP 1.96
- Scripting Commands OFP 1.46
- Scripting Commands ArmA
- Command Group: Variables
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters