Author: Big
Author Website: http://www.arma2web.xf.cz/

Requirements: No addons required

Version: 1.0

Short description: This is a very simple script countdowning the time.

Date: 2010-06-12 08:04


Comments: (1)
Rating:



 





3-countdownpic.jpg

CountDown
by
resistance-rat


Description:
This is a very simple script countdowning the time.
In the main script "countdown.sqs" are three variables.
    time_0, time_1 and time_2.
    time_0 presents second numeral of seconds.
    time_1 presents first numeral of seconds.
    time_2 presents minutes.
The second script "hint.sqs" showing the time countdowning.


Installation:
It comes with a mission as a demo version. Extract the pbo file to your ArmA2\Missions.


Scripts:
countdown.sqs
[] exec "hint.sqs"
time_0 = 9
time_1 = 5
time_2 = 1


#timeloop
time_0 = time_0 - 1
? time_0 == -1 : time_1 = time_1 - 1; time_0 = 9 
? (time_1 == 0) and (time_0 == 0) : time_2 = time_2 - 1; time_1 = 5; time_0 = 9 
~1
goto "timeloop"

hint.sqs
#loop
hintSilent format ["Reinforcements arrive: %1:%2%3", time_2, time_1, time_0]
? (time_2 < 0) : goto "end"
~0.1
goto "loop"

#end
hintSilent "Reinforcements arriving..."
exit


Myke's MP compatible Script:
//nul = [951, "Reinforcements arrive:", "Reinforcements arriving..."] execVM "timer.sqf"
private ["_remaining", "_ref", "_timer", "_msg1", "_msg2"];
_timer = _this select 0;
_msg1 = _this select 1;
_msg2 = _this select 2;
_ref = time;
"glt_timerMsg" addPublicVariableEventHandler {[] call glt_showCountdown};
if (isnil "glt_timeFormat") then {
	glt_timeFormat = {
		private ["_hours", "_minutes", "_seconds"];
		_hours = 0;
		_minutes = 0;
		_seconds = 0;
		_seconds = _this;
		if (_seconds > 59) then {
			_minutes = floor (_seconds / 60);
			_seconds = _seconds - (_minutes * 60);
		};
		if (_minutes > 59) then {
			_hours = floor (_minutes / 60);
			_minutes = _minutes - (_hours * 60);
		};
		if (_seconds < 10) then {
			_seconds = format ["0%1", _seconds];
		};
		if (_minutes < 10) then {
			_minutes = format ["0%1", _minutes];
		};
		[_hours, _minutes, _seconds]
	};
};

if (isnil "glt_showCountdown") then {
	glt_showCountdown = {
		hintsilent glt_TimerMsg;
	};
};

if (isServer) then {
	while {_timer > 0} do {
		_remaining = _timer call glt_timeFormat;
		glt_timerMsg = format ["%1\n\n%2:%3:%4",_msg1, (_remaining select 0), (_remaining select 1), (_remaining select 2)];
		publicVariable "glt_timerMsg";
		if (local player) then {[] call glt_showCountdown};
		_timer = _timer - 1;
		sleep 1;
	};
};
glt_timerMsg = _msg2;
publicVariable "glt_timerMsg";
if (local player) then {[] call glt_showCountdown};


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: No tags