Log in

View Full Version : what does sleep do



zenma
08-06-2007, 06:06 PM
hey what does the command sleep(1) i read somewhere it reduces lag but how do you use it and how does it reduce lag
edit: i already searched for it found nothing

bullzeye95
08-06-2007, 06:07 PM
It's the same thing as wait.

rotflmfwao
08-07-2007, 02:47 AM
Which reduces lag by giving the cpu a millisecond to recover from what it was doing.


Sleep(1);
is the same as
Wait(1);

zenma
08-07-2007, 05:34 AM
oh ok so why not replace all waits to sleeps?

Tim0suprem0
08-07-2007, 06:09 AM
Yeah if wait and sleep are the same thing, why do they both exist?

bullzeye95
08-07-2007, 06:10 AM
oh ok so why not replace all waits to sleeps?

What would be the point in that?

rotflmfwao
08-07-2007, 03:05 PM
I think they both exist because it helps some people who used other programing languages before SCAR. I used AU3 and it had Sleep instead of Wait. I could be wrong, but thats just what I think.

zenma
08-08-2007, 05:20 PM
wait wait wait... let me get this straight. wait is EXACTLY the same as sleep? no difference at all? if yes then nvm theres no point. if no then well idk, lol

Starblaster100
08-08-2007, 05:24 PM
There is a subtle difference.

Wait uses the Process command. When you load a ton of Procedures into a SCAR loop, it will not execute them until it comes across a process command (which is in "wait") Thats why we always have tiny waits in our scripts, so SCAR can process everything we tell it to do and not lag like hell.

Sleep doesn't have this process command. It just simply waits or "puts the application to sleep" for a certain amount of time you set.

Tim0suprem0
08-08-2007, 06:03 PM
Thanks starblaster :)

Markus
08-08-2007, 06:03 PM
So instead of tiny waits, why don't do GetApplication.Processmessages?

Starblaster100
08-08-2007, 06:20 PM
Thats basically what Wait is. but sometimes we need to do more GetApplication.Processmessages then normal, depending on the resources our procedures take up. Wait is just a nice little procedure to do that for us so as we dont have



ClickMouse(x, y, True);
GetApplication.Processmessage
GetApplication.Processmessage
GetApplication.Processmessage
GetApplication.Processmessage
GetApplication.Processmessage
GetApplication.Processmessage
GetApplication.Processmessage
GetApplication.Processmessage
ClickMouse(x, y, False);


everywhere :p

Markus
08-08-2007, 06:28 PM
Yeah, that's a bit ugly.

zenma
08-09-2007, 04:55 AM
thanks starblaster i think i got it now basicly wait > sleep

Cheesehunk
08-09-2007, 05:05 AM
oh ok so why not replace all waits to sleeps?
Sleep contains 1 extra letter, waste of valuable time..:rolleyes:

Bobarkinator
08-09-2007, 06:00 AM
Sleep contains 1 extra letter, waste of valuable time..:rolleyes:

That's a good way to look at it :p