Blitzen88 16 Posted July 14, 2022 Greetings, My understanding is the Spawn and ExecVM commands allow for the scheduler to execute scripts when time allows for it based upon the current engine load. I believe the Exec command, however, executes scripts immediately when “called.” However, how does the scheduler handle looping scripts which are initially executed via the Spawn and ExecVM commands? For instance, say I execute a script via Spawn/ExecVM and it loops every 3 minutes. Will the scheduler delay the execution of the loop since the script was initially called with Spawn/ExecVM? Thanks Share this post Link to post Share on other sites
sarogahtyp 1104 Posted July 14, 2022 Forget bout exec. This is not for sqf scripts. call is executing immediatly when used in unscheduled environment. Everytging bout it is described here: https://community.bistudio.com/wiki/Scheduler Share this post Link to post Share on other sites
pierremgi 4737 Posted July 14, 2022 And don't exexVM an sqf in a loop, you multiply compilation of codes for nuts. Create a function and spawn it in loop. Follow links. Share this post Link to post Share on other sites
Blitzen88 16 Posted July 14, 2022 1 hour ago, pierremgi said: And don't exexVM an sqf in a loop, you multiply compilation of codes for nuts. Create a function and spawn it in loop. Follow links. Im NOT talking about this: while (true) do { execVM script; sleep 1} Im talking about this: while (true) do { something; sleep 1} How does the scheduler deal with the loop? Share this post Link to post Share on other sites
Harzach 2505 Posted July 14, 2022 16 minutes ago, Blitzen88 said: while (true) do { something; sleep 1} How does the scheduler deal with the loop? It depends on what "something" is and what else is going on. Which is why code optimization can be so important. Share this post Link to post Share on other sites
sarogahtyp 1104 Posted July 14, 2022 1 hour ago, pierremgi said: Follow links. This! Share this post Link to post Share on other sites
Blitzen88 16 Posted July 14, 2022 1 minute ago, sarogahtyp said: This! Will do. Thank you! Share this post Link to post Share on other sites