Jump to content
Sign in to follow this  
YDrogen

[Resolved] Skip time function working in multiplayer

Recommended Posts

Hi everyone !

So I have a really simple question that I'm sure you have already seen before.

It's about skip time, but more like "X hours and Y minutes.

I'm searching for hours now, I keep trying again and again, without any success. Even the BIKI can't make me do things correctly ! :(

So here I am !

 

I have made 2 samples to my function :

cutText ["", "BLACK FADED", 600];

private ["_hoursToSkip","_minutesToSkip"];

_msg = [[" _hoursToSkip HEURES AND _minutesToSkip MINNUTES LATER ... ","<t align = 'center' shadow = '1' size = '1.0'>%1</t><br/>"]]spawn BIS_fnc_typeText;

_hoursToSkip = _this select 0;
_minutesToSkip= _this select 1;

skipTime (_hoursToSkip + 0._minutesToSkip - daytime + 24 ) % 24;

waitUntil{scriptDone _msg};

cutText ["", "BLACK IN", 5];
cutText ["", "BLACK FADED", 600];

private ["_hoursToSkip","_minutesToSkip"];

_msg = [[" _hoursToSkip HEURES ET _minutesToSkip MINNUTES PLUS TARD ... ","<t align = 'center' shadow = '1' size = '1.0'>%1</t><br/>"]]spawn BIS_fnc_typeText;

return date = _actualDate;
_actualDateN = dateToNumber _actualDate;
_actualDateN + _hoursToSkip*0.00274 + _minutesToSkip*0.000046 = _newDateN;
_finalDate = numberToDate _newDateN;
setDate _finalDate;

waitUntil{scriptDone _msg};

cutText ["", "BLACK IN", 5];

Declared in the "description.ext" file :

class CfgFunctions
{
   class Y
   {
      class timeSkip
      {
         file = "functions";
         class timeSkip {};
         ext = ".sqf";
      };
   };
};

Saved as "functions\fn_timeSkip.sqf" and detected in the InGame function menu aswell.

 

None of them works with this command :

[["5","5"],"Y_fnc_timeSkip",true,true] call BIS_fnc_MP;

I need to make it work in multiplayer.

 

 

The beginning of the function work great, I got a black screen. But nothing else. Sometimes, the _msg appears (with [5,5] as array instead of ["5","5"]), sometimes not.

 

Can you help me with that ?

Thanks a lot ! :)

 

 

Full working code here (link to reply on this topic)

Share this post


Link to post
Share on other sites
Guest

Hello, why do you use strings instead of integers in the Y_fnc_timeSkip args ?

By the way, you don't retrieve your args in your function.

 

EDIT : J'ai vu que tu étais français si tu as besoin que je te traduise mon message je le ferais.

Share this post


Link to post
Share on other sites

// english below

 

Avec des integers, même résultat, j'ai vraiment tout essayé.

J'ai écrit un nouveau code sur un autre principe (récupérer la date, la décortiquer, ajouter le temps, la "recompiler" et faire un setDate) et toujours rien, j'pige vraiment pas.

Je débute dans le milieu, ça doit faire bientôt 60 heures que je travaille sur ma première mission et cette fonction m'a déjà prit 10h de taffe.

 

 

By the way, you don't retrieve your args in your function.

 
C'est à dire ?
private ["_hoursToSkip","_minutesToSkip"];
_hoursToSkip = 0;
_minutesToSkip = 0;
_hoursToSkip = _this select 0;
_minutesToSkip = _this select 1;

_now = 0;
_year = 0;
_month = 0;
_day = 0;
_hour = 0;
_min = 0;
_yearAdd = 0;
_monthAdd = 0;
_dayAdd = 0;
_hourAdd = 0;
_minAdd = 0;

_now = date;
_year = _now select 0;
_month = _now select 1;
_day = _now select 2;
_hour = _now select 3;
_min  = _now select 4;

_yearAdd = _year;
_monthAdd = _month;
_dayAdd = _day;
_hourAdd = _hour + _hoursToSkip ;
_minAdd = _min + _minutesToSkip ;

while
{
	(_minAdd >= 60)
}
	do
	{
		_minAdd - 60 ;
		_hourAdd + 1 ;
	};
		
	
	
while
{
	(_hourAdd >= 24)
}
	do
	{
		_hourAdd - 24 ;
		_dayAdd + 1 ;
	};
		
		
		
while
{
	(_dayAdd >= 30)
}
	do
	{
		_dayAdd - 30 ;
		_monthAdd + 1 ;
	};

	
	
while
{
	(_monthAdd >= 12)
}
	do
	{
		_monthAdd - 12 ;
		_yearAdd + 1 ;
	};

_newDate = format ["%1", [_yearAdd, _monthAdd, _dayAdd, _hourAdd, _minAdd]];
setDate _newDate;

Here is the new code

 

Same results with integers I tried everything.

I wrote an entire new code (above) with the date system, then add the "_hoursToSkip / _minutesToSkip" and a setDate but it doesn't work at all, I don't understand why.

I'm a beginner in scripting, and only this function has already took me up to 10 hours of work over my 60 on my project !

 

By the way, you don't retrieve your args in your function.

 
Meaning ?

Share this post


Link to post
Share on other sites
Guest

Tu devrais utiliser skipTime au lieu de setDate non ?

 

//

 You should use the skipTime function instead of setDate one ?

Share this post


Link to post
Share on other sites

// english below

Ouai, effectivement, le setDate est local, du coup, pas synchro avec le serveur.

Mais avec le skipTime j'ai un problème :

cutText ["", "BLACK FADED", 300];

private ["_hoursToSkip","_minutesToSkip"];

_hoursToSkip = _this select 0;
_minutesToSkip= _this select 1;
_minutesToSkipEff = _minutesToSkip / 60 / 10;

skipTime (_hoursToSkip + _minutesToSkipEff);

_msg = [[" %0 HEURES ET %1 MINUTES PLUS TARD ... ", "<t align = 'center' shadow = '1' size = '1.0'></t>", _hoursToSkip, _minutesToSkip]]spawn BIS_fnc_typeText;

waitUntil{scriptDone _msg};

cutText ["", "BLACK IN", 5];

Quand j'exécute la fonction avec cette commande là :

[[11,30],"Y_fnc_timeSkip",true,true] call BIS_fnc_MP;

J'ai une erreur en retour de typeText qui me dit que le "30" est SCALAR alors qu'il devrait être STRING, et je n'ai aucune idée de pourquoi, ni même de comment corriger ça.

 

 

 

 

//

Yes but I've just learned that the setDate is local, so it's not sync with the server.

But with skipTime I got a problem :

cutText ["", "BLACK FADED", 300];

private ["_hoursToSkip","_minutesToSkip"];

_hoursToSkip = _this select 0;
_minutesToSkip= _this select 1;
_minutesToSkipEff = _minutesToSkip / 60 / 10;

skipTime (_hoursToSkip + _minutesToSkipEff);

_msg = [[" %0 HEURES ET %1 MINUTES PLUS TARD ... ", "<t align = 'center' shadow = '1' size = '1.0'></t>", _hoursToSkip, _minutesToSkip]]spawn BIS_fnc_typeText;

waitUntil{scriptDone _msg};

cutText ["", "BLACK IN", 5];

When I execute this function with this command here :

[[11,30],"Y_fnc_timeSkip",true,true] call BIS_fnc_MP;

I have a return error from typeText that says that the "30" is SCALAR instead of STRING, and I have no idea why and how to correct this.

Share this post


Link to post
Share on other sites
Guest

Essaye de convertir ta variable en string alors.

bouh = 1;
str bouh;

Share this post


Link to post
Share on other sites

Exact !

_msg = [[str _hoursToSkip, " HEURES ET", str _minutesToSkip, "MINUTES PLUS TARD ... ", "<t align = 'center' shadow = '1' size = '1.0'></t>"]]spawn BIS_fnc_typeText;

Merci beaucoup ! Ca va faire 11 heures que je suis sur cette fonction...

 

Here is the complete working code :

cutText ["", "BLACK FADED", 300]; // Black screen

private ["_hoursToSkip","_minutesToSkip"]; // var declaration

_hoursToSkip = _this select 0; // hours to skip
_minutesToSkip= _this select 1; // minutes to skip
_minutesToSkipEff = _minutesToSkip / 60 / 10; // minutes percentage


skipTime (_hoursToSkip + _minutesToSkipEff); // hours to skip + minutes percentage (1.75 hours = 1hour 45mins)

_msg = [[str _hoursToSkip, " HEURES ET", str _minutesToSkip, "MINUTES PLUS TARD ... ", "<t align = 'center' shadow = '1' size = '1.0'></t>"]]spawn BIS_fnc_typeText; // large sweg message

waitUntil{scriptDone _msg}; // wait until the sweg message disappear

cutText ["", "BLACK IN", 5]; // and then, the black screen fade away...

description.ext :

class CfgFunctions
{
	class Y
	{
		class timeSkip
		{
			file = "functions";
			class timeSkip {};
			ext = ".sqf";
		};
	};
};

Line to launch it :

[[19,30],"Y_fnc_timeSkip",true,true] call BIS_fnc_MP; // 19 = Hours to skip // 30 = Minutes to skip

Works on multiplayer servers.

Share this post


Link to post
Share on other sites

Salut,

 

J'aimerai rendre ton Script répétable du genre skip 3 heures [en jeu] toute les heures [Dans la réalité], j'ai a peu pres tout essayé mais je suis ignorant et incompétent :lol:  alors j'éspére que vous pourrait m'aider!

 

//

Hi

 

I want to make your script repeatable kind of skip 3 hours [in game] every hours [in real life], i already try everything i can without result but I am ignorant and incompetent :lol: so i hope you can help me!

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
Sign in to follow this  

×