count: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
[[Category:Scripting Commands]]
[[Category:Scripting Commands|C]]
[[Category:Scripting Commands OFP 1.97]]
[[Category:Scripting Commands OFP 1.97|C]]
[[Category:Scripting Commands OFP 1.46]]
[[Category:Scripting Commands OFP 1.46|C]]
[[Category:Scripting Commands ArmA]]
[[Category:Scripting Commands ArmA|C]]


back to [[Scripting_Reference#C|COMREF]]
back to [[Scripting_Reference#C|COMREF]]

Revision as of 18:09, 22 April 2006


back to COMREF


condition count array


Operand types:

condition: String

array: Array

Type of returned value:

Number

Description:

Counts elements in array for which given condition is true.

It is calculated as follows:

Set count to 0.
For each element of array assign element as _x and evaluate condition expression.
If true increase count.


Example:

"_x > 2" count [0, 1, 1, 2, 3, 3] ...... Result is 2


Comments:

Use this to calculate how many "M16" mags a soldier has left.

("_x == {M16}" count magazines soldier1)