BIS fnc lookAtArray: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "{{Function|= Comments | arma3 |Game name= |1.78|Game version= <!---|arg= local |Multiplayer Arguments=---> <!---|eff= local |Multiplayer Effects=---> | <pre>/* Author: R...")
 
m (Text replacement - " (\|[pr][0-9]+ *= *[^-]+) *- *A([a-z])" to " $1 - a$2")
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function


| arma3 |Game name=
|game1= arma3
|version1= 1.78


|1.78|Game version=
|gr1= Interaction


<!---|arg= local |Multiplayer Arguments=--->
|descr= Executes a code when one of the specified objects is looked at (player's cursor pointed towards it) for enough time


<!---|eff= local |Multiplayer Effects=--->
|s1= [initialize, lookAtData] call [[BIS_fnc_lookAtArray]]


| <pre>/*
|p1= initialize: [[Boolean]] - [[true]] to initialize, [[false]] to remove it
Author: Riccardo Argiolas


Description:
|p2= lookAtData: [[Array]] - an array with arrays of look-up-data in form of:
    Exectues a code when one of the specified objects is looked at (player's cursor pointed towards it) for enough time.
*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


Parameters:
|r1= [[Nothing]]
Select 0 - ARRAY: list of objects to be looked at
Select X - Array element
Select 0 - OBJECT: object to be looked at
Select 1 - NUMBER: how long do we have to look at it
Select 2 - BOOL: whether we shall remove the array entry after the object has been looked at
Select 3 - CODE: code to be spawned when we look at the object for enough time


Returns: None
|x1= <sqf>
 
private _lookAtArray =
Examples:
[
 
[
_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,  
BIS_apc, //name of object
2,
2, //time we have to look at it
false,
false, //do we destroy the entry after we looked at it
{ ["apc looked at"] call BIS_fnc_log; }
{["What a wonderful APC"] call bis_fnc_log;} //code
]
],
];
[
[true, _lookAtArray] spawn "BIS_fnc_lookAtArray";
BIS_otherUnit,
sleep 15;
2,
[false] spawn "BIS_fnc_lookAtArray";
false,
</sqf>
{["apc looked at"] call bis_fnc_log;}
]
];
[true, _lookAtArray] spawn "BIS_fnc_lookAtArray";
sleep 15;
[false] spawn "BIS_fnc_lookAtArray";
*/</pre>{{Informative|Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]]}} |Description=


|[] call [[BIS_fnc_lookAtArray]]|Syntax=
|seealso= [[BIS_fnc_lookAtArrayEH]]
 
|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
 
|Datatype - description|Return value=
 
|x1= <code></code>|Example 1=
 
|exec= call |Execution=
 
| |See also=
}}
}}
[[Category:Function Group: Systems|{{uc:lookAtArray}}]]
[[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