{"name":"BIS_fnc_VRTimer","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","games":{"arma3":"1.00"},"since":"arma3 1.00","arma3_since":"1.00","locality":{"effect":"local"},"exec":"spawn","description":"Timer for VR and time trials. The following missionNamespace variables can be used:\n\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","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)","type_expr":"String","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","type_expr":"Nothing"}}],"examples":[{"code":["[] spawn BIS_fnc_VRTimer;"]},{"code":["\"#025D00\" spawn BIS_fnc_VRTimer;"]},{"code":["[\"#025D00\"] spawn BIS_fnc_VRTimer;"]}],"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```"}]}