Jump to content
tortuosit

Linear execution, how?

Recommended Posts

Hey guys...

 

[] execvm "code1.sqf"; [] execvm "code2.sqf";

 

I start this from inside the debug console. Let's say code1.sqf is not an endless loop, ie. does terminate. How can I call the scripts in a way that code2.sqf starts AFTER code1.sqf has been finished? In a gosub/return kind of way? I'm not at my rig but I guess a preprocessor would not work in a debug console..

 

Thx.

Share this post


Link to post
Share on other sites
thing = [] spawn
{
	scriptOneHandle = [] execvm "code1.sqf"; 
	waitUntil {scriptDone scriptOneHandle};
	scriptTwoHandle = [] execvm "code2.sqf";
};

 

  • Like 1

Share this post


Link to post
Share on other sites
thing = [] spawn {
	[] call compile preprocessFileLineNumbers "code1.sqf";
	[] call compile preprocessFileLineNumbers "code2.sqf";
};

Works too, as you can still "call" scripts if they contain sleeps in a scheduled environment.

This will start code2 after code1 finished.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks that clears things up perfectly. My old brain should have remembered waituntil/scriptdone, because I regularly use it 😄

2nd solution is quite beautiful.

I wish I could use "#define ccp call compile preprocessFileLineNumbers" in a debug console or logic, for saving space inside the ArmA UI, but hey.

Share this post


Link to post
Share on other sites

Work with CfgFunctions instead, the extra overhead is worth the structure and ease of recompile.

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, mrcurry said:

Work with CfgFunctions instead, the extra overhead is worth the structure and ease of recompile.

 

Functions Library

 

Share this post


Link to post
Share on other sites
1 hour ago, mrcurry said:

Work with CfgFunctions instead, the extra overhead is worth the structure and ease of recompile.

 

I never did. So basically, is it about registering my own functions into ArmA for... easier... use?

Share this post


Link to post
Share on other sites
16 minutes ago, tortuosit said:

 

I never did. So basically, is it about registering my own functions into ArmA for... easier... use?

 

mainly it preprocesses and precompiles your scripts into functions for faster execution on runtime. Also it enables the ability to call or spawn those functions to fit your needs.

execVM e.g. preprocesses and compiles the script everytime you run it. functions are preprocessed/compiled (mostly) one time only.

  • Like 1

Share this post


Link to post
Share on other sites

BIS_fnc_spawnOrdered will spawn given function in order it was called. Coming to dev branch soon

  • Like 1

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

×