Jump to content
Sign in to follow this  
mossman1223

Sleep doesn't work

Recommended Posts

For some reason when I try to run scripts from within the mission editor the "sleep" command doesn't work.

sleep 5; 
hint "This message should display 5 seconds after this script is executed.";

The above code displays the hint immediately, ignoring the sleep command. Any idea why?

---------- Post added at 17:34 ---------- Previous post was at 17:17 ----------

So I just figured out that when I try

[] spawn {
sleep 5; 
hint "This message should display 5 seconds after this script is executed.";
};

the script works.

Why is this? What does this 'spawn' command do, and why didn't the sleep function work to begin with?

Share this post


Link to post
Share on other sites

I guess that when you execute code from a trigger for instance, it is like using "call". Which forbids the use of "sleep". there are some subtleties though: see the notes at the bottom of the Biki page for "call".

PS: I don't understand the concept of non-scheduled/scheduled environment discussed in the above-mentionned page. Anyone?

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  

×