Wait command
Hard to search the forum for this, too many results :/
My question is pretty simple, what wait command equals a second? Previously I thought it was 1000, but I'm using a script right now that behaves differently when it comes to wait length... Just looking for some confirmation
My question is pretty simple, what wait command equals a second? Previously I thought it was 1000, but I'm using a script right now that behaves differently when it comes to wait length... Just looking for some confirmation
From my DinkC Reference book:
void wait(int period);
wait will cause the current script to pause at least period milliseconds before continuing.
1000 milliseconds = 1 second, so...I dunno.
void wait(int period);
wait will cause the current script to pause at least period milliseconds before continuing.
1000 milliseconds = 1 second, so...I dunno.
I don't know what's the problem with your script. 1000 should mean a second.
I know, I have the book sitting right next to me too
But, do me a favor and try this:
This SHOULD take 5 seconds, but it takes a few seconds longer. (it's a spawned script)
But, do me a favor and try this:
void main (void) { int &timer = 500; say("start", 1); loop: &timer -= 1; wait(10); if (&timer > 0) { goto loop; } say("done", 1); kill_this_task(); }
This SHOULD take 5 seconds, but it takes a few seconds longer. (it's a spawned script)
It takes time to run trough a script and you're doing that 500 times here so you'll notice it takes longer.
I think this is because the execution of the script also takes time. (Given that your computer isn't infinitely fast) Try setting the wait to 100 and measure the deviation then to see if I'm right. (Haven't actually tested this)
This effect can be a bit of a pain in the ass for some functions. Usually one wait(1000); is better then 10 wait(100);'s...
This effect can be a bit of a pain in the ass for some functions. Usually one wait(1000); is better then 10 wait(100);'s...
You're right, if I do a wait(5000) it is (almost) exactly 5 seconds.
This is annoying It shouldn't take seconds to process scripts, even if it's 500 times. I suspect it's an inherent weakness in the coding, nothing I can do about it I guess I'll just make 2 scripts then and have one work with the full wait time.
This is annoying It shouldn't take seconds to process scripts, even if it's 500 times. I suspect it's an inherent weakness in the coding, nothing I can do about it I guess I'll just make 2 scripts then and have one work with the full wait time.
It's fun to create manual lag like this though. Mess with someone's game and initiate this script and it'll annoy the heck out of them
void main () { script_attach(1000); int &crap; loop: &crap += 1; if (&crap < 2500) goto loop; wait(500); &crap = 0; goto loop; }
it's because when the dink engine reads the "wait(period)" command it runs through all the other scripts that are active at the time before returning to the said script (but not before the "period" of time is up)
check this
check this