BIS fnc lookAtArray: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category\:Function Group\: Systems(\|\{\{[a-zA-Z0-9_:]+\}\})?\]\]" to "")
m (Text replacement - " (\|[pr][0-9]+ *= *[^-]+) *- *A([a-z])" to " $1 - a$2")
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function
{{RV|type=function


|game1= arma3
|game1= arma3
|version1= 1.78
|version1= 1.78


<!--|exec= server|=-->
|gr1= Interaction
 
<!--|arg= local-->
 
<!--|eff= local-->


|descr= Executes a code when one of the specified objects is looked at (player's cursor pointed towards it) for enough time
|descr= Executes a code when one of the specified objects is looked at (player's cursor pointed towards it) for enough time
Line 15: Line 10:
|s1= [initialize, lookAtData] call [[BIS_fnc_lookAtArray]]
|s1= [initialize, lookAtData] call [[BIS_fnc_lookAtArray]]


|p1= initialize: [[Boolean]] - [[True]] to initialize, [[false]] to remove it
|p1= initialize: [[Boolean]] - [[true]] to initialize, [[false]] to remove it


|p2= lookAtData: [[Array]] - An array with arrays of look-up-data in form of:
|p2= lookAtData: [[Array]] - an array with arrays of look-up-data in form of:
*0: [[Object]] - Object to be looked at
*0: [[Object]] - Object to be looked at
*1: [[Number]] - How long player has to look at it
*1: [[Number]] - How long player has to look at it
*2: [[Boolean]] - [[True]] to remove it from array when player looked at it
*2: [[Boolean]] - [[true]] to remove it from array when player looked at it
*3: [[Code]] - Code spawned when player looked long enough at the object
*3: [[Code]] - Code spawned when player looked long enough at the object


|r1= [[Nothing]]
|r1= [[Nothing]]


|x1= <code>_lookAtArray =  
|x1= <sqf>
[
private _lookAtArray =  
  [
[
  BIS_apc,           //name of object
[
  2,           //time we have to look at it
BIS_apc, // name of object
  [[false]],           //do we destroy the entry after we looked at it
2, // time we have to look at it
  {["What a wonderful APC"] [[call]] [[BIS_fnc_log]];} //code
false, // do we destroy the entry after we looked at it
  ],
{ ["What a wonderful APC"] call BIS_fnc_log; } // code
  [
],
  BIS_otherUnit,  
[
  2,
BIS_otherUnit,  
  [[false]],
2,
  {["apc looked at"] [[call]] [[BIS_fnc_log]];}
false,
  ]
{ ["apc looked at"] call BIS_fnc_log; }
];
]
<noWiki>[</noWiki>[[true]], _lookAtArray] [[spawn]] "[[BIS_fnc_lookAtArray]]";
];
[[sleep]] 15;
[true, _lookAtArray] spawn "BIS_fnc_lookAtArray";
<noWiki>[</noWiki>[[false]]<noWiki>]</noWiki> [[spawn]] "[[BIS_fnc_lookAtArray]]";</code>
sleep 15;
 
[false] spawn "BIS_fnc_lookAtArray";
|exec= call
</sqf>


|seealso= [[BIS_fnc_lookAtArrayEH]]
|seealso= [[BIS_fnc_lookAtArrayEH]]
}}
}}
[[Category:Functions|{{uc:lookAtArray}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:lookAtArray}}]]

Latest revision as of 12:40, 8 November 2023

Hover & click on the images for description

Description

Description:
Executes a code when one of the specified objects is looked at (player's cursor pointed towards it) for enough time
Execution:
call
Groups:
Interaction

Syntax

Syntax:
[initialize, lookAtData] call BIS_fnc_lookAtArray
Parameters:
initialize: Boolean - true to initialize, false to remove it
lookAtData: Array - an array with arrays of look-up-data in form of:
  • 0: Object - Object to be looked at
  • 1: Number - How long player has to look at it
  • 2: Boolean - true to remove it from array when player looked at it
  • 3: Code - Code spawned when player looked long enough at the object
Return Value:
Nothing

Examples

Example 1:
private _lookAtArray = [ [ BIS_apc, // name of object 2, // time we have to look at it false, // do we destroy the entry after we looked at it { ["What a wonderful APC"] call BIS_fnc_log; } // code ], [ BIS_otherUnit, 2, false, { ["apc looked at"] call BIS_fnc_log; } ] ]; [true, _lookAtArray] spawn "BIS_fnc_lookAtArray"; sleep 15; [false] spawn "BIS_fnc_lookAtArray";

Additional Information

See also:
BIS_fnc_lookAtArrayEH

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