BIS fnc VRTimer: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...)
m (Text replacement - " |s1=[" to " |s1= [")
 
(23 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function
{{RV|type=function


| arma3
|game1= arma3
 
|version1= 1.00
|1.00


|gr1= VR
|gr1= VR


|eff= local |MP Effects=
|eff= local


| Timer for VR and time trials. The following [[missionNamespace]] variables can be used:
|descr= Timer for VR and time trials. The following [[missionNamespace]] variables can be used:
* <tt>BIS_stopTimer</tt>: set to [[true]] to stop the timer. Once stopped, the function must be executed again to restart the timer
* {{hl|BIS_stopTimer}}: set to [[true]] to stop the timer. Once stopped, the function must be executed again to restart the timer
* <tt>RscFiringDrillTime_current</tt>: fill with [[Structured Text]] to display text instead of timer (when timer is stopped)
* {{hl|RscFiringDrillTime_current}}: fill with [[Structured Text]] to display text instead of timer (when timer is stopped)
* <tt>RscFiringDrillTime_done</tt>: set to [[true]] to close the display. '''''Stop the timer first'''''
* {{hl|RscFiringDrillTime_done}}: set to [[true]] to close the display. '''''Stop the timer first'''''


| [colour] spawn [[BIS_fnc_VRTimer]]
|s1= [colour] spawn [[BIS_fnc_VRTimer]]


|p1= colour: [[String]] (Optional, default {{Inline code|(["IGUI", "WARNING_RGB"] [[call]] [[BIS_fnc_displayColorGet]]) [[call]] [[BIS_fnc_colorRGBtoHTML]]}}) timer colour in HTML format (#{{Color|red|RR}}{{Color|green|GG}}{{Color|blue|BB}})
|p1= colour: [[String]] (Optional, default <sqf inline>(["IGUI", "WARNING_RGB"] call BIS_fnc_displayColorGet) call BIS_fnc_colorRGBtoHTML</sqf>) timer colour in HTML format (#{{Color|red|RR}}{{Color|green|GG}}{{Color|blue|BB}})


| [[Nothing]]
|r1= [[Nothing]]


|x1= <code>[] [[spawn]] [[BIS_fnc_VRTimer]];</code>
|x1= <sqf>[] spawn BIS_fnc_VRTimer;</sqf>


|x2= <code>"#025D00" [[spawn]] [[BIS_fnc_VRTimer]];</code>
|x2= <sqf>"#025D00" spawn BIS_fnc_VRTimer;</sqf>


|x3= <code>["#025D00"] [[spawn]] [[BIS_fnc_VRTimer]];</code>
|x3= <sqf>["#025D00"] spawn BIS_fnc_VRTimer;</sqf>


| [[BIS_fnc_displayColorGet]], [[BIS_fnc_colorRGBtoHTML]]
|seealso= [[BIS_fnc_displayColorGet]] [[BIS_fnc_colorRGBtoHTML]]
}}
}}


<h3 style="display:none">Notes</h3>
{{Note
<dl class="command_description">
|user= Lou Montana
<!-- Note Section BEGIN -->
|timestamp= 20180604195000
|text= Here is a countdown, inspired by this function:
<sqf>
LM_fnc_timeoutCountdown = {


<dd class="notedate">Posted on June 04, 2018 - 19:50 (UTC)
params [
<dt class="note">[[User:Lou Montana|Lou Montana]]
["_time", 30, [0]],
<dd class="note">
["_colour", "#FFFFFF", [""]]
Here is a countdown, inspired by this function:<br>
];
<spoiler text="Show function">
private _timeout = time + _time;
LM_fnc_timeoutCountdown = {
RscFiringDrillTime_done = false;
1 cutRsc ["RscFiringDrillTime", "PLAIN"];
[[params]] [
while { time < _timeout } do
["_time", 30, [0]],
{
["_colour", "#FFFFFF", [""]]
private _remainingTime = _timeout - time;
];
private _timeFormat = [_remainingTime, "MM:SS.MS", true] call BIS_fnc_secondsToString;
[[private]] _timeout = [[time]] + _time;
private _text = format ["<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>",
RscFiringDrillTime_done = [[false]];
_colour,
1 [[cutRsc]] ["RscFiringDrillTime", "PLAIN"];
"A3\Modules_F_Beta\data\FiringDrills\timer_ca",
[[while]] { [[time]] < _timeout } [[do]]
_timeFormat select 0,
{
_timeFormat select 1,
[[private]] _remainingTime = _timeout - [[time]];
_timeFormat select 2
[[private]] _timeFormat = [_remainingTime, "MM:SS.MS", [[true]]] [[call]] [[BIS_fnc_secondsToString]];
];
[[private]] _text = [[format]] ["<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>",
RscFiringDrillTime_current = parseText _text;
_colour,
sleep 0.01;
"A3\Modules_F_Beta\data\FiringDrills\timer_ca",
};
_timeFormat [[select]] 0,
private _timeFormat = [0, "MM:SS.MS", true] call BIS_fnc_secondsToString;
_timeFormat [[select]] 1,
RscFiringDrillTime_current = parseText format ["<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>",
_timeFormat [[select]] 2
_colour,
];
"A3\Modules_F_Beta\data\FiringDrills\timer_ca",
RscFiringDrillTime_current = [[parseText]] _text;
_timeFormat select 0,
[[sleep]] 0.01;
_timeFormat select 1,
};
_timeFormat select 2];
[[private]] _timeFormat = [0, "MM:SS.MS", [[true]]] [[call]] [[BIS_fnc_secondsToString]];
sleep 4;
RscFiringDrillTime_current = [[parseText]] [[format]] ["<t align='left' color='%1'><img image='%2' />%3:%4<t size='0.8'>.%5</t>",
RscFiringDrillTime_done = true;
_colour,
};
"A3\Modules_F_Beta\data\FiringDrills\timer_ca",
</sqf>
_timeFormat [[select]] 0,
_timeFormat [[select]] 1,
_timeFormat [[select]] 2];
[[sleep]] 4;
RscFiringDrillTime_done = [[true]];
};</spoiler>
and to use it:
and to use it:
<code>[10, "#FF5500"] [[spawn]] LM_fnc_timeoutCountdown;</code>
<sqf>[10, "#FF5500"] spawn LM_fnc_timeoutCountdown;</sqf>
 
}}
<!-- Note Section END -->
</dl>
 
<h3 style="display:none">Bottom Section</h3>

Latest revision as of 23:11, 12 July 2022

Hover & click on the images for description

Description

Description:
Timer for VR and time trials. The following missionNamespace 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:
VR

Syntax

Syntax:
[colour] spawn 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:
[] spawn BIS_fnc_VRTimer;
Example 2:
"#025D00" spawn BIS_fnc_VRTimer;
Example 3:
["#025D00"] spawn BIS_fnc_VRTimer;

Additional Information

See also:
BIS_fnc_displayColorGet BIS_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
Lou Montana - c
Posted on Jun 04, 2018 - 19:50 (UTC)
Here is a countdown, inspired by this function:
LM_fnc_timeoutCountdown = { params [ ["_time", 30, [0]], ["_colour", "#FFFFFF", [""]] ]; private _timeout = time + _time; RscFiringDrillTime_done = false; 1 cutRsc ["RscFiringDrillTime", "PLAIN"]; while { time < _timeout } do { private _remainingTime = _timeout - time; private _timeFormat = [_remainingTime, "MM:SS.MS", true] call BIS_fnc_secondsToString; private _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; }; private _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; };
and to use it:
[10, "#FF5500"] spawn LM_fnc_timeoutCountdown;