Jump to content

Recommended Posts

Hi guys,

I would like you to help me with this:

 

Minutes = 10;
publicvariable "Minutes";
Minutesd = true;
publicvariable "Minutesd";

waitUntil {!isnil "Minutes"};
 
while {(Minutesd) && (Minutes > 0)} do {

		[{hintSilent parsetext format ["<br /><t align='center' color='#FF0000' size='1.3' font='TahomaB' >%1</t><br />",[((Minutes)/60)+.01,"HH:MM"] call BIS_fnc_timetostring];},"BIS_fnc_spawn",TRUE,FALSE] spawn BIS_fnc_MP;
		
      Minutes = Minutes - 1;
      publicvariable "Minutes";
      sleep 1;
 
};
Minutes = 0;
true;

waituntil {(Minutesd) && (Minutes == 0)};
// Script

"EVERYONEWON" call BIS_fnc_endMissionServer;

 

How could I do so that time counts by hour, minutes, seconds, since this counter only drops from minutes, if I add hours it gives me an error and it drops the time directly as if they were seconds.

Share this post


Link to post
Share on other sites

Could you explain a bit more about what you're trying to do?  I don't completely understand what exactly you're trying to do.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, stanhope said:

Could you explain a bit more about what you're trying to do?  I don't completely understand what exactly you're trying to do.

I trying make timer to start count down in 2 hour, but I could not, in a script, it only appears in the minutes, but I would like the counter to appear with the remaining time in hours, minutes, seconds and not just minutes and seconds.

Share this post


Link to post
Share on other sites
1 hour ago, Mr H. said:

 

I have this function in the script but I can not do the calculation to make for example the time that I put fence reducing by seconds and not by minutes a counter relog. example, if I put two hours as a countdown, fence showing a count, when it reaches 00 seconds subtract one minute, when it reaches 00 minutes, subtract one hour, until the counter reaches zero to run the following script.

Share this post


Link to post
Share on other sites

from what I see in your script your minutes are actually seconds if I'm not mistaken. Also if it can help you I made this timer script a while ago, you'll have to modify it and remove the calls to other functions but maybe it will help you:
 

/* variable générées:
publicTimerOver ==> BOOL ==> true si le timer est over
*/


//if (checkrun) exitWith {};
checkrun = true;
//////pour que le script ne s'execute qu'une fois.

//récupération des params de la fonction
_publicTime = _this select 0;



//////////////////////
publicTimerOver = false;
while {publicTimerON && _publicTime>10} do {

_publicTime = _publicTime -1;
if (publicTimerPaused) exitWith {[_publicTime] call MRH_fnc_PausedTimerTime};
sleep 1;
_timestamp = _publicTime/3600;
_timedisplay = [_timestamp, "HH:MM:SS"] call BIS_fnc_timeToString;
["<t font = 'PuristaMedium'><t size = '1'>" + _timedisplay + "</t>",0.8,-0.05,1,0] spawn BIS_fnc_dynamicText; 
};
//10 dernieres secondes en rouge avec bip
while {publicTimerON && _publicTime<=10 && _publicTime>= 0} do {
_publicTime = _publicTime -1;
sleep 1;
_timestamp = _publicTime/3600;
_timedisplay = [_timestamp, "HH:MM:SS"] call BIS_fnc_timeToString;
["<t font = 'PuristaMedium'><t size = '1'><t color = '#FF0000'>" + _timedisplay + "</t>",-1,-1,1,0] spawn BIS_fnc_dynamicText;
playSound "biptimer";
};
checkrun = false;
if (_publicTime <= 0) exitWith {publicTimerOver = true; publicVariable "publicTimerOver";}; 

 

  • Like 3

Share this post


Link to post
Share on other sites
9 hours ago, Mr H. said:

from what I see in your script your minutes are actually seconds if I'm not mistaken. Also if it can help you I made this timer script a while ago, you'll have to modify it and remove the calls to other functions but maybe it will help you:
 


/* variable générées:
publicTimerOver ==> BOOL ==> true si le timer est over
*/


//if (checkrun) exitWith {};
checkrun = true;
//////pour que le script ne s'execute qu'une fois.

//récupération des params de la fonction
_publicTime = _this select 0;



//////////////////////
publicTimerOver = false;
while {publicTimerON && _publicTime>10} do {

_publicTime = _publicTime -1;
if (publicTimerPaused) exitWith {[_publicTime] call MRH_fnc_PausedTimerTime};
sleep 1;
_timestamp = _publicTime/3600;
_timedisplay = [_timestamp, "HH:MM:SS"] call BIS_fnc_timeToString;
["<t font = 'PuristaMedium'><t size = '1'>" + _timedisplay + "</t>",0.8,-0.05,1,0] spawn BIS_fnc_dynamicText; 
};
//10 dernieres secondes en rouge avec bip
while {publicTimerON && _publicTime<=10 && _publicTime>= 0} do {
_publicTime = _publicTime -1;
sleep 1;
_timestamp = _publicTime/3600;
_timedisplay = [_timestamp, "HH:MM:SS"] call BIS_fnc_timeToString;
["<t font = 'PuristaMedium'><t size = '1'><t color = '#FF0000'>" + _timedisplay + "</t>",-1,-1,1,0] spawn BIS_fnc_dynamicText;
playSound "biptimer";
};
checkrun = false;
if (_publicTime <= 0) exitWith {publicTimerOver = true; publicVariable "publicTimerOver";}; 

 

 

what do I do here?

 

_publicTime = _this select 0;

 

I skipped an error of defined variable of the expression in _publicTime = _this select 0, I apologize that it does not know is that I am still learning and there are still things that I do not have very clear.

Share this post


Link to post
Share on other sites

that's your input time in seconds for 2 hours for example [7200] execVM "whateveryounamethe.sqf"

  • Like 1

Share this post


Link to post
Share on other sites
On 31/8/2018 at 1:19 AM, Mr H. said:

that's your input time in seconds for 2 hours for example [7200] execVM "whateveryounamethe.sqf"

 

Hi @Mr H.

 

I'm sorry for the time without an answer. I was trying as you had indicated and here I expose the error that I get.

 

Arma3_Error%20Timer_zps29vkbqr6.png

Error in the defined variable of the expression: publictimeron

 

I put it as you had indicated. How could I solve that error?

 

thank you.

Share this post


Link to post
Share on other sites

Define it.

 

Put publictimeron = true before the while loop.

  • Like 1

Share this post


Link to post
Share on other sites
Just now, stanhope said:

Define it.

 

Put publictimeron = true before the while loop.

 

jajaja thanks man,

 

I am analyzing the code well, I already managed to run it, now it is just to put the sound of the beep

Share this post


Link to post
Share on other sites

Yes, as I said when I posted you'll have to change it because I use it along with other stuff you might not need (functions to pause it etc.). Also this is an old code, I would not do it like this if I were to do it today but it still does the job. I have plans to rework it but I'm a bit lazy. ^^
Complete code can be found spread between here and here

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
3 minutes ago, Mr H. said:

Yes, as I said when I posted you'll have to change it because I use it along with other stuff you might not need (functions to pause it etc.). Also this is an old code, I would not do it like this if I were to do it today but it still does the job. I have plans to rework it but I'm a bit lazy. ^^
Complete code can be found spread between here and here

 

Very much thanks @Mr H.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×