{"name":"BIS_fnc_lookAtArray","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","games":{"arma3":"1.78"},"since":"arma3 1.78","arma3_since":"1.78","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","params":[{"name":"initialize","type":"Boolean","description":"true to initialize, false to remove it","type_expr":"Boolean"},{"name":"lookAtData","type":"Array","description":"an array with arrays of look-up-data in form of:\n\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","type_expr":"Array"}],"returns":{"type":"Nothing","type_expr":"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\";"]}],"see_also":["BIS_fnc_lookAtArrayEH"]}