BIS fnc VRTimer: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Fix description, add comment)
m (Fix note)
Line 36: Line 36:
<dd class="note">
<dd class="note">
Here is a countdown, inspired by this function:
Here is a countdown, inspired by this function:
<spoiler><code>_timeout = {
<spoiler>
params [
[[private]] _timeout = {
["_time", 30, [0]],
[[params]] [
["_colour", "#FFFFFF", [""]]
["_time", 30, [0]],
];
["_colour", "#FFFFFF", [""]]
private _timeout = time + _time;
];
private ["_text", "_remainingTime", "_timeFormat"];
[[private]] _timeout = [[time]] + _time;
RscFiringDrillTime_done = false;
[[private]] ["_text", "_remainingTime", "_timeFormat"];
1 cutRsc ["RscFiringDrillTime", "PLAIN"];
RscFiringDrillTime_done = [[false]];
while { time < _timeout } do
1 [[cutRsc]] ["RscFiringDrillTime", "PLAIN"];
{
[[while]] { [[time]] < _timeout [[}]] do
_remainingTime = _timeout - time;
{
_timeFormat = [_remainingTime, "MM:SS.MS", true] call BIS_fnc_secondsToString;
_remainingTime = _timeout - [[time]];
_text = format ["<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>",
_timeFormat = [_remainingTime, "MM:SS.MS", [[true]]] [[call]] [[BIS_fnc_secondsToString]];
_colour,
_text = [[format]] ["<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>",
"A3\Modules_F_Beta\data\FiringDrills\timer_ca",
_colour,
_timeFormat select 0,
"A3\Modules_F_Beta\data\FiringDrills\timer_ca",
_timeFormat select 1,
_timeFormat [[select]] 0,
_timeFormat select 2];
_timeFormat [[select]] 1,
RscFiringDrillTime_current = parseText _text;
_timeFormat [[select]] 2];
sleep 0.01;
RscFiringDrillTime_current = [[parseText]] _text;
};
[[sleep]] 0.01;
_timeFormat = [0, "MM:SS.MS", true] call BIS_fnc_secondsToString;
};
RscFiringDrillTime_current = parseText format ["<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>",
_timeFormat = [0, "MM:SS.MS", true] [[call]] [[BIS_fnc_secondsToString]];
_colour,
RscFiringDrillTime_current = [[parseText]] [[format]] ["<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>",
"A3\Modules_F_Beta\data\FiringDrills\timer_ca",
_colour,
_timeFormat select 0,
"A3\Modules_F_Beta\data\FiringDrills\timer_ca",
_timeFormat select 1,
_timeFormat [[select]] 0,
_timeFormat select 2];
_timeFormat [[select]] 1,
sleep 4;
_timeFormat [[select]] 2];
RscFiringDrillTime_done = true;
[[sleep]] 4;
};</code></spoiler>
RscFiringDrillTime_done = [[true]];
};</spoiler>
and to use it:
and to use it:
<code>[10, "#FF5500"] call _timeout;</code>
<code>[10, "#FF5500"] [[call]] _timeout;</code>


<!-- Note Section END -->
<!-- Note Section END -->

Revision as of 21:45, 2 August 2019

Hover & click on the images for description

Description

Description:
Timer for VR and time trials. The following variables can be used:
  • BIS_stopTimer: set to true to stop the timer. Once stopped, the function must be executed again to restart the timer
  • RscFiringDrillTime_current: fill with Structured Text to display text instead of timer (when timer is stopped)
  • RscFiringDrillTime_done: set to true to close the display. Stop the timer first
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
colour call BIS_fnc_VRTimer
Parameters:
colour: String (Optional, default (["IGUI", "WARNING_RGB"] call BIS_fnc_displayColorGet) call BIS_fnc_colorRGBtoHTML) timer colour in HTML format (#RRGGBB)
Return Value:
Nothing

Examples

Example 1:
call BIS_fnc_VRTimer;
Example 2:
"#025D00" call BIS_fnc_VRTimer;

Additional Information

See also:
BIS_fnc_displayColorGetBIS_fnc_colorRGBtoHTML

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

Notes

Posted on June 04, 2018 - 19:50 (UTC)
Lou Montana
Here is a countdown, inspired by this function:
private _timeout = {
	params [
		["_time", 30, [0]],
		["_colour", "#FFFFFF", [""]]
	];
	private _timeout = time + _time;
	private ["_text", "_remainingTime", "_timeFormat"];
	RscFiringDrillTime_done = false;
	1 cutRsc ["RscFiringDrillTime", "PLAIN"];
	while { time < _timeout [[}]] do
	{
		_remainingTime = _timeout - time;
		_timeFormat = [_remainingTime, "MM:SS.MS", true] call BIS_fnc_secondsToString;
		_text = format ["<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>",
			_colour,
			"A3\Modules_F_Beta\data\FiringDrills\timer_ca",
			_timeFormat select 0,
			_timeFormat select 1,
			_timeFormat select 2];
		RscFiringDrillTime_current = parseText _text;
		sleep 0.01;
	};
	_timeFormat = [0, "MM:SS.MS", true] call BIS_fnc_secondsToString;
	RscFiringDrillTime_current = parseText format ["<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>",
		_colour,
		"A3\Modules_F_Beta\data\FiringDrills\timer_ca",
		_timeFormat select 0,
		_timeFormat select 1,
		_timeFormat select 2];
	sleep 4;
	RscFiringDrillTime_done = true;
};
↑ Back to spoiler's top
and to use it: [10, "#FF5500"] call _timeout;

Bottom Section