{"name":"BIS_fnc_lookAtArray","operator":null,"title":"BIS fnc lookAtArray","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_lookAtArray","revid":348199,"updated":"2023-11-08T11:40:09Z","groups":["Interaction"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.78"}],"since":{"game":"arma3","name":"Arma 3","version":"1.78"},"arma3_since":"1.78","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Executes a code when one of the specified objects is looked at (player's cursor pointed towards it) for enough time","syntaxes":[{"syntax":"[initialize, lookAtData] call BIS_fnc_lookAtArray","since":null,"effect":null,"exec":null,"params":[{"name":"initialize","type":"Boolean","optional":false,"default":null,"description":"true to initialize, false to remove it","types":["Boolean"],"since":null,"text":"initialize: Boolean - true to initialize, false to remove it"},{"name":"lookAtData","type":"Array","optional":false,"default":null,"description":"an array with arrays of look-up-data in form of:\n- 0: Object - Object to be looked at\n- 1: Number - How long player has to look at it\n- 2: Boolean - true to remove it from array when player looked at it\n- 3: Code - Code spawned when player looked long enough at the object","types":["Array"],"since":null,"text":"lookAtData: Array - an array with arrays of look-up-data in form of:\n- 0: Object - Object to be looked at\n- 1: Number - How long player has to look at it\n- 2: Boolean - true to remove it from array when player looked at it\n- 3: Code - Code spawned when player looked long enough at the object"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\nprivate _lookAtArray = \n[\n    [\n        BIS_apc,                                        // name of object\n        2,                                                // time we have to look at it\n        false,                                            // do we destroy the entry after we looked at it\n        { [\"What a wonderful APC\"] call BIS_fnc_log; }    // code\n    ],\n    [\n        BIS_otherUnit, \n        2,\n        false,\n        { [\"apc looked at\"] call BIS_fnc_log; }\n    ]\n];\n[true, _lookAtArray] spawn \"BIS_fnc_lookAtArray\";\nsleep 15;\n[false] spawn \"BIS_fnc_lookAtArray\";\n```","code":["private _lookAtArray = \n[\n\t[\n\t\tBIS_apc,\t\t\t\t\t\t\t\t\t\t// name of object\n\t\t2,\t\t\t\t\t\t\t\t\t\t\t\t// time we have to look at it\n\t\tfalse,\t\t\t\t\t\t\t\t\t\t\t// do we destroy the entry after we looked at it\n\t\t{ [\"What a wonderful APC\"] call BIS_fnc_log; }\t// code\n\t],\n\t[\n\t\tBIS_otherUnit, \n\t\t2,\n\t\tfalse,\n\t\t{ [\"apc looked at\"] call BIS_fnc_log; }\n\t]\n];\n[true, _lookAtArray] spawn \"BIS_fnc_lookAtArray\";\nsleep 15;\n[false] spawn \"BIS_fnc_lookAtArray\";"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_lookAtArrayEH"],"notes":[],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Interaction","Functions","Introduced with Arma 3 version 1.78"],"docblock":null,"filled_from_docblock":[]}