Move an object multiple times

Yes, the game stops rendering, streaming sound, and transmitting network data entirely because of a sleep command in a script. You’ve got it. Let me say this again: you don’t know.

Ill say it again too: I really dont know.
Anyway, im pretty sure sleep only pauses the script it’s in. Not the whole game.

GS1 is read like a book, and when a sleep occurs, it pauses reading for X amount of seconds, then continues reading. Php’s sleep function has about the same behaviour.

Right. But if you play a sound and then execute a sleep it wont just stop the sound/music prematurely.

No, it won’t. It just won’t execute what comes next until the timer has ended. Anything executed before won’t be paused.

Just trying to fix this misinformation

There are plenty of other things you can do to make time pass without stopping the whole script.

He was sarcastic…

In both the NPC-server and the GameEngine I’m working on, the scripts run asynchronous and have no sleep function, btw.

Nope. Codr has no sense of sarcasm.

He was obviously making fun of your statement about the cpu cycles. lol

ew

That’s how a cpu keeps time. Time on a computer is a function of cpu ticks and cpu speed. So when you tell a script to sleep a number of seconds you are actually telling the script to stop running for a some amount of cpu cycles. I never said that the entire game stops during a sleep command.

As if, faggot.

Lol @ neg rep

You have your script looping unnecessarily where instead of feeding it a broken value you could just break the loop.

if (timeout) {
  x += vecx(this.mode);
  y += vecy(this.mode);
  timeout = 0.05;
}

becomes

if (timeout && this.mode < 4){
  x += vecx(this.mode);
  y += vecy(this.mode);
  timeout = 0.05;
}

Sure, it’s not much, but stack of a few shit scripts on top of each other and you’ll eventually notice some lag.

Just because it’s graal, and just because it’s a noob language doesn’t mean you can throw away efficiency.

That’s all? I thought you were talking about the tokenize or something. I just wrote it up and didn’t test it lol

Yeah, that’s better for lag.