Jump to content
Sign in to follow this  
Big Ben

skipTime

Recommended Posts

This is a cool little script to see all the different times of day, but the script the way it is doesn't work as it did in OFP or ARMA. Is there a different way to write it? Any help would be greatly appreciated.

Condition: this

On act: this exec"example.sqs"

where example is the name of the script.

this can also be used as true.

this is the script:

#loop
skiptime .000333
~0.1
goto "loop"

The value can be changed to make it longer or shorter to fit the mission makers taste.

I viewed about 30 or so pages on the forums, and I searched the wiki:

http://community.bistudio.com/wiki/skipTime

This code found on the wiki page, did not work for me. I may not have used it right.

while {true} do {skiptime 0.00333; sleep 0.1}

Share this post


Link to post
Share on other sites

You just need a semicolon at the end like this:

while {true} do {skiptime 0.00333; sleep 0.1};

Tests fine for me like that.

Share this post


Link to post
Share on other sites
You just need a semicolon at the end like this:

while {true} do {skiptime 0.00333; sleep 0.1};

Tests fine for me like that.

Wait... don't you also need a semicolon at the end of "sleep 0.1" as well? i.e.

While {true} do {skipTime 0.00333; sleep 0.1;};

Edited by kyfohatl

Share this post


Link to post
Share on other sites
Wait... don't you also need a semicolon at the end of "sleep 0.1" as well? i.e.

While {true} do {skipTime 0.00333; sleep 0.1;};

No, not with an inline code like that.

Share this post


Link to post
Share on other sites

No. If so you'd also need a semicolon after true.

The semicolon can be omitted for the last statement of a block (a block is anything enclosed in curly braces).

Share this post


Link to post
Share on other sites

Oh, ok. Thanks. I've been writing all my scripts with a semicolon at the end of EVERY line, including the last line of a block (they seem to work fine). Does it make a difference?

Share this post


Link to post
Share on other sites

No, not really. I tend to do it if I split it into lines. Not because it's right or wrong, but because when copying that line or making a new one, I won't get the accidental "missing ;" error messages. Only in "one command within scope" do I not use ;.

Share this post


Link to post
Share on other sites

Ok I changed the script from this:

#loop
skiptime .000333
~0.1
goto "loop"

to this:

#loop
while {true} do {skiptime 0.00333; sleep 0.1};
~0.1
goto "loop"

I call the script like this, in a trigger:

On act: this exec"example.sqs"

It still doesn't work. Would anyone like to see an example mission with what I have so far to make sure it is correct? I tried it a couple of other ways too, but still no luck.

Using this code by itself, in a trigger, instantly jumps to night time. I need the loop to make the transition smooth.

while {true} do {skiptime 0.00333; sleep 0.1};

Thank you all for you help and very quick replies.

Share this post


Link to post
Share on other sites

This new form of code is in SQF, not SQS. So you need to save it as an SQF file. Plus, there is no need for the goto "loop" stuff; while {true} do {} is already a loop itself. I don't think a while {} loop would work well in a trigger. Just save it in a notepad as an sqf file, then put:

OnActivation : Myprocedure = [] execVM "example.sqf"

in the trigger.

Remember, your code should now be:

whie {true} do {skipTime 0.00333; sleep 0.1};

No more "#Loop" or "goto" stuff. That's in SQS only.

Should work fine now.

Edited by kyfohatl

Share this post


Link to post
Share on other sites

No need for triggers or separate files, just paste this into init.sqf:

[] spawn {while {true} do {skiptime 0.00333; sleep 0.1};};

Share this post


Link to post
Share on other sites

Also, when calling .sqf code, you need to use execVM rather than exec. But for something this short, shk's method is best.

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  

×