{"name":"BIS_fnc_VRTimer","operator":null,"title":"BIS fnc VRTimer","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_VRTimer","revid":376474,"updated":"2025-10-16T20:10:46Z","groups":["VR"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.00"}],"since":{"game":"arma3","name":"Arma 3","version":"1.00"},"arma3_since":"1.00","branch":null,"locality":{"argument":null,"effect":"local","server_exec":false},"exec":"spawn","description":"Timer for VR and time trials. The following missionNamespace variables can be used:\n- `BIS_stopTimer`: set to true to stop the timer. Once stopped, the function must be executed again to restart the timer\n- `RscFiringDrillTime_current`: fill with Structured Text to display text instead of timer (when timer is stopped)\n- `RscFiringDrillTime_done`: set to true to close the display. ***Stop the timer first***","syntaxes":[{"syntax":"[colour] spawn BIS_fnc_VRTimer","since":null,"effect":null,"exec":null,"params":[{"name":"colour","type":"String","optional":true,"default":"`([\"IGUI\", \"WARNING_RGB\"] call BIS_fnc_displayColorGet) call BIS_fnc_colorRGBtoHTML`","description":"timer colour in HTML format (#RRGGBB)","types":["String"],"since":null,"text":"colour: String (Optional, default `([\"IGUI\", \"WARNING_RGB\"] call BIS_fnc_displayColorGet) call BIS_fnc_colorRGBtoHTML`) timer colour in HTML format (#RRGGBB)"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n[] spawn BIS_fnc_VRTimer;\n```","code":["[] spawn BIS_fnc_VRTimer;"]},{"text":"```sqf\n\"#025D00\" spawn BIS_fnc_VRTimer;\n```","code":["\"#025D00\" spawn BIS_fnc_VRTimer;"]},{"text":"```sqf\n[\"#025D00\"] spawn BIS_fnc_VRTimer;\n```","code":["[\"#025D00\"] spawn BIS_fnc_VRTimer;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_displayColorGet","BIS_fnc_colorRGBtoHTML"],"notes":[{"user":"Lou Montana","date":"2018-06-04T19:50:00Z","text":"Here is a countdown, inspired by this function:\n\n```sqf\nLM_fnc_timeoutCountdown = {\n\n    params [\n        [\"_time\", 30, [0]],\n        [\"_colour\", \"#FFFFFF\", [\"\"]]\n    ];\n    private _timeout = time + _time;\n    RscFiringDrillTime_done = false;\n    1 cutRsc [\"RscFiringDrillTime\", \"PLAIN\"];\n    while { time < _timeout } do\n    {\n        private _remainingTime = _timeout - time;\n        private _timeFormat = [_remainingTime, \"MM:SS.MS\", true] call BIS_fnc_secondsToString;\n        private _text = format [\"<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>\",\n            _colour,\n            \"A3\\Modules_F_Beta\\data\\FiringDrills\\timer_ca\",\n            _timeFormat select 0,\n            _timeFormat select 1,\n            _timeFormat select 2\n        ];\n        RscFiringDrillTime_current = parseText _text;\n        sleep 0.01;\n    };\n    private _timeFormat = [0, \"MM:SS.MS\", true] call BIS_fnc_secondsToString;\n    RscFiringDrillTime_current = parseText format [\"<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>\",\n        _colour,\n        \"A3\\Modules_F_Beta\\data\\FiringDrills\\timer_ca\",\n        _timeFormat select 0,\n        _timeFormat select 1,\n        _timeFormat select 2];\n    sleep 4;\n    RscFiringDrillTime_done = true;\n};\n```\n\nand to use it:\n\n```sqf\n[10, \"#FF5500\"] spawn LM_fnc_timeoutCountdown;\n```"}],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: VR","Functions","Functions: Local Effect","Introduced with Arma 3 version 1.00"],"docblock":null,"filled_from_docblock":[]}