Jump to content
Sign in to follow this  
Graz

Setdate script not running properly

Recommended Posts

I recently made a really, really simple script for time changing.

Essentially it just advances time from dusk (when it goes pitchblack) to moonrise, the reason is to eliminate pitch black game-play.

I attempted to test it by using the 3d editor, setting the time in intel to 18:30 and then executing the script in the init line of an object. I'm hoping the issue is in how I tested it.

The script is really basic, I'll post it here:It uses a while do loop and runs every 5 minutes.


//moonrise
while {true} do {
private ["_timeG"];
_timeG = daytime;
if (_timeg >= 17.5 && _timeg <= 21.5) then {
setDate [2008, 11, 20, 21, 35];
}
else {hint "time is ok!"};
sleep 300;
};
[/Code]

No errors but it doesn't change the time. The only two commands I'm using are daytime and setdate.

Is it my testing or is there something wrong with the script?

What's the best way to test if a script like this is working?

Share this post


Link to post
Share on other sites

Seems to work ok here , at 5:30 the time jumps to 21:35

You could just use a waituntil

waituntil {daytime >= 17.40}; 
setDate [2008, 11, 20, 21, 35];

I don't think you need anything else.

Share this post


Link to post
Share on other sites

Awesome, what did you test it with?

Share this post


Link to post
Share on other sites

I just called it from a gamelogic init

null=[] execvm "Skip_time.sqf"

and saved the file as skip_time.sqf

I then ran it from 2D editor, I never use 3D.

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  

×