Difference between revisions of "list"

From Bohemia Interactive Community
Jump to navigation Jump to search
(expanded return descr.)
m (Some wiki formatting)
 
(57 intermediate revisions by 14 users not shown)
Line 1: Line 1:
{{Command|= Comments
+
{{RV|type=command
____________________________________________________________________________________________
 
  
| ofp |= Game name
+
|game1= ofp
 +
|version1= 1.00
  
|1.00|= Game version
+
|game2= ofpe
 +
|version2= 1.00
  
|arg= global |= Arguments in MP
+
|game3= arma1
____________________________________________________________________________________________
+
|version3= 1.00
  
| List of units that would activate given [[Triggers|Trigger]].
+
|game4= arma2
 +
|version4= 1.00
  
For trigger of type "Not present" the list is the same as that returned for "present". |= Description
+
|game5= arma2oa
____________________________________________________________________________________________
+
|version5= 1.50
  
|[[Array]] <nowiki>=</nowiki>  '''list ''trigger''''' |= Syntax
+
|game6= tkoh
 +
|version6= 1.00
  
|p1= trigger: [[Object]] |= Parameter 1
+
|game7= arma3
 +
|version7= 0.50
  
| [[Array]] - returns a '''[[Array#Array_references|pointer]]''' to the trigger's list.<br>Since this is just a ''reference'' this means that the value in your local variable will change as the content of the trigger area changes. To permanently copy the returned list to a different variable, use _mylist <nowiki>=</nowiki> +(list triggerOne). |= Return value
+
|arg= global
____________________________________________________________________________________________
+
|eff= local
 
 
|x1= <code>_tlist <nowiki>=</nowiki> '''list''' _triggerOne </code>|= Example 1
 
____________________________________________________________________________________________
 
  
| |= See also
+
|gr1= Triggers
  
 +
|descr= List of units that would activate given [[Triggers|Trigger]].
 +
 +
It returns nothing before the simulation started, i.e. in (undelayed) init.sqf files. Returns a '''[[Array#Array_references|pointer]]''' to the trigger's list after the simulation started.<br>Since this is just a ''reference'' this means that the value in your local variable will change as the content of the trigger area changes. To permanently copy the returned list to a different variable, use {{ic|_mylist {{=}} +([[list]] triggerOne)}}.
 +
 +
The second example can be used inside the trigger (in that case, no need to name your trigger).
 +
 +
The list returned for trigger of type "Not present" is the same as that returned for type "present".
 +
 +
{{Feature|important|While the command can query any trigger, local or remote, the result will be only for the trigger condition set on the local client. See [[createTrigger]] for more info.}}
 +
 +
|s1= [[list]] trigger
 +
 +
|p1= trigger: [[Object]]
 +
 +
|r1=[[Array]] or [[Nothing]]
 +
 +
|x1= <code>_triggerList = [[list]] _triggerOne;</code>
 +
 +
|x2= <code>[[hint]] [[format]] ["%1", [[thisList]]];</code>
 +
 +
|seealso= [[setTriggerActivation]], [[createTrigger]], [[thisList]]
 
}}
 
}}
  
<h3 style="display:none">Notes</h3>
 
 
<dl class="command_description">
 
<dl class="command_description">
<!-- Note Section BEGIN -->
+
 
* To use the trigger list ''inside'' the trigger definition (in the "On Activation/Deactivation" fields) use the array <tt>thislist</tt> instead.
+
<dt><dt>
<code>{player sidechat format["%1 activated trigger",_x]} foreach thislist</code>
+
<dd class="notedate">Posted on March 6, 2013 - 14:15 (CEST)</dd>
<!-- Note Section END -->
+
<dt class="note">[[User:TeaCup|teaCup]]</dt>
 +
<dd class="note">Calling [[list]] immediately after creating a trigger via [[createTrigger]] (and setting up activation, area, statements, timeout, etc..), will return <null> instead of an array. It seems the trigger needs about 1 second to initialise, after which it will behave as expected: returning an array of all the objects inside the trigger (the ones matching the criteria), or an empty array.
 +
</dd>
 +
 
 +
<dt></dt>
 +
<dd class="notedate">Posted on January 6, 2021 - 01:58 (UTC)</dd>
 +
<dt class="note">[[User:7erra|7erra]]</dt>
 +
<dd class="note">
 +
The resulting array is not modifiable. Any [[:Category:Command_Group:_Arrays|array related commands]], that modify the original array, will fail with the error message: {{ic|Error Reserved variable in expression}}.
 +
</dd>
 +
 
 
</dl>
 
</dl>
 
<h3 style="display:none">Bottom Section</h3>
 
[[Category:Scripting Commands|LIST]]
 
[[Category:Scripting Commands OFP 1.96|LIST]]
 
[[Category:Scripting Commands OFP 1.46|LIST]]
 
[[Category:Scripting Commands ArmA|LIST]]
 
[[Category:Command_Group:_Variables|{{uc:{{PAGENAME}}}}]]
 

Latest revision as of 17:09, 13 June 2021

Hover & click on the images for description

Description

Description:
List of units that would activate given Trigger. It returns nothing before the simulation started, i.e. in (undelayed) init.sqf files. Returns a pointer to the trigger's list after the simulation started.
Since this is just a reference this means that the value in your local variable will change as the content of the trigger area changes. To permanently copy the returned list to a different variable, use _mylist = +(list triggerOne). The second example can be used inside the trigger (in that case, no need to name your trigger). The list returned for trigger of type "Not present" is the same as that returned for type "present".
While the command can query any trigger, local or remote, the result will be only for the trigger condition set on the local client. See createTrigger for more info.
Groups:
Triggers

Syntax

Syntax:
list trigger
Parameters:
trigger: Object
Return Value:
Array or Nothing

Examples

Example 1:
_triggerList = list _triggerOne;
Example 2:
hint format ["%1", thisList];

Additional Information

See also:
setTriggerActivationcreateTriggerthisList

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
Posted on March 6, 2013 - 14:15 (CEST)
teaCup
Calling list immediately after creating a trigger via createTrigger (and setting up activation, area, statements, timeout, etc..), will return <null> instead of an array. It seems the trigger needs about 1 second to initialise, after which it will behave as expected: returning an array of all the objects inside the trigger (the ones matching the criteria), or an empty array.
Posted on January 6, 2021 - 01:58 (UTC)
7erra
The resulting array is not modifiable. Any array related commands, that modify the original array, will fail with the error message: Error Reserved variable in expression.