Jump to content
Sign in to follow this  
bravo 6

sleep x on .sqf

Recommended Posts

when i try to use this command

sleep 1

in a file.sqf and run it in edior, calling the file i have an error..

why?

shouldn't it recognize it in arma?! huh.gif

Share this post


Link to post
Share on other sites

Only spawn and execVM scripts(.sqf) can be slept for x seconds.

If you did something like: ["zomg"] call myFunction

This doesn't starta a thread for it and therefor can not be paused when entered in init-lines or on act for triggers.

Share this post


Link to post
Share on other sites

ok i think i understand...

in the .sqs files we could delay the cameras for ~x (x secounds)

i was hoping to hold in sqf aswell with the sleep.

oh well..

thanks anyway. wink_o.gif

Share this post


Link to post
Share on other sites

just change "call" to either "execVM" or "spawn" and it'll work.

Share this post


Link to post
Share on other sites
just change "call" to either "execVM" or "spawn" and it'll work.

i just used the "execVM" instead "exec"

thanks! wink_o.gif

ps- i really dont understand this language at all crazy_o.gif

dont know how people can understand these kinda tricks biggrin_o.gif

Share this post


Link to post
Share on other sites

Either use execVM and assign it to a variable, or use:

call { [] execVM "script.sqf"; };

Both should work, however I prefer the 2nd option.

If you need more details, take a look at my Basics of SQF tutorial, you can find it on www.ofpec.com.

Share this post


Link to post
Share on other sites

Yeah!

That tutorial of yours is a good start!

I was looking for it but didn't find it as I was to link it in this thread.

I've looked it through and I give it a yay.gif

Share this post


Link to post
Share on other sites

instead of creating a file.sqf and execute it as virtual machine, you can put it's content in a function body like:

yourfunction={sqf-contents....};

and precompiling the file containing these functions inside init.sqf on top.

from this point you can call/spawn your programmed functions at any point in the game.

call functions without sleeps,

[] spawn functions with sleeps,

then your problems are gone and all scripts are stored as functions in a single file.

Regards,

zap

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  

×