sleep – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
(Potential bug:)
Line 52: Line 52:


::::For that sort of thing, looking at [[time]] or _time are better. You cannot have it continue after exactly n seconds, but you can find out exactly how much time did pass since last time. --[[User:MaHuJa|MaHuJa]] 11:04, 20 February 2007 (CET)
::::For that sort of thing, looking at [[time]] or _time are better. You cannot have it continue after exactly n seconds, but you can find out exactly how much time did pass since last time. --[[User:MaHuJa|MaHuJa]] 11:04, 20 February 2007 (CET)
== Potential bug: ==
I have noticed that if I attempt to execute the following;
sleep _timeToWaitUntil-time;
Then a bug in the parser causes the machine to sleep for _timeToWaitUntil seconds.
Adding brackets solves the problem and it behaves as expected:
sleep (_timeToWaitUntil-time);

Revision as of 03:36, 9 January 2010

Does this command also work in functions? --T_D 20:15, 21 July 2006 (CEST)


I don't think functions ever sleep. They must start and finish, returning the result somewhere, even if it is to null.

They don't pause,,,,thats my understanding anyway.

Planck 20:25, 21 July 2006 (CEST)

I think yes...

I think yes, functions are as piece of code as other piece of code.

Djura 20:30, 21 July 2006 (CEST)


Djura, as the new Armed Assault script commands are still WIP, I don't think it is wise to add information to them other than that which we were supplied with by BI.

The description for sleep supplied was 'Suspend execution of script for given time.'

I won't remove what you added but it would be wiser to wait till BI finalise the command set and its operators.

Planck 13:10, 24 July 2006 (CEST)

I'll respect it. (For future: Write this kind of messages to my talk page please.) --Djura 19:45, 24 July 2006 (CEST)

For some insight, check my post here: http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=10a67f0f44abe94275f48130af94f253;act=ST;f=71;t=55788;st=30

Igor Drukov 23:30, 16 December 2006 (GMT+1)

Generic error in expression

When I use the sleep command in a script, the game says : |#|sleep 1; ... Generic error in expression. Note that the |#| isn't in my code, it's just in the error message. It says this however I use the command... I tried a workaround using waitUntil, but it throws the same error message. I can't suspend scripts in Armed Assault...?

You have to execute the script with execVM or spawn. --raedor 15:19, 12 February 2007 (CET)


Notes

Kronzky : Sleep durations between .0005 and .02 will cause the same delay (roughly .02 seconds). Delays of .0005 and less have no effect.

Isn't it directly related to FPS and therefore system dependant? 0.02 seconds = ~50fps. --Ceeeb
Yes, the absolute delay varies (that's why I put in "roughly"), but the main point is that it doesn't matter whether you use a delay of .01 or .001, as they end up being the same. --Kronzky 03:41, 13 February 2007 (CET)
Experimation shows that sleep granularity is measured in frames. Sleep 0.001 is equivalent to 'wait for next frame' no matter how fast your PC. Sleep 0.02 = 0.02 seconds at 50fps or (not so obviously) 0.032 seconds at 60fps. Basically, you shouldn't try to use sleep for fine-grained timing.
For that sort of thing, looking at time or _time are better. You cannot have it continue after exactly n seconds, but you can find out exactly how much time did pass since last time. --MaHuJa 11:04, 20 February 2007 (CET)

Potential bug:

I have noticed that if I attempt to execute the following;

sleep _timeToWaitUntil-time;

Then a bug in the parser causes the machine to sleep for _timeToWaitUntil seconds.

Adding brackets solves the problem and it behaves as expected:

sleep (_timeToWaitUntil-time);