Jump to content
Sign in to follow this  
zagor64bz

Can you run more than....

Recommended Posts

..one call compile preprocessFileLineNumbers "Scripts\My_fnc_whatever.sqf" in the init.sqf?

I try to get call compile preprocessFileLineNumbers "Scripts\My_fnc_whatever_2.sqf" to work if I call it with 

_whatever = ["parameter 1",parameter 2,parameter 3] spawn MY_fnc_whatever_2;

but no luck.

 

in the init the code is:

call compile preprocessFileLineNumbers "Scripts\MY_fnc_whatever.sqf";
sleep 1;
call compile preprocessFileLineNumbers "Scripts\MY_fnc_whatever_2.sqf";

Any suggestion?

 

Thank you.

Share this post


Link to post
Share on other sites

What exactly are you asking?  Are you trying to call 2 separate functions?  Or the same function twice?

 

To the question:

Quote

Can you run more than one call compile preprocessFileLineNumbers "Scripts\My_fnc_whatever.sqf" in the init.sqf?

yes. 

Share this post


Link to post
Share on other sites
5 minutes ago, stanhope said:

What exactly are you asking?  Are you trying to call 2 separate functions?  Or the same function twice?

Actually, I'm not sure.

 

I'm using a script from GOM, ""Carpet bombing" with a radio trigger to drop some ordnance on target.I wanna  use 2 radio trigger to drop different bombs type, which is easily achieved by changing the parameters in the calling line. The problem is that I want to add some vanilla radio chat to the script, that's easy, but 2 different ones, accordingly to which radio trigger you call .

 

At this point I better ask @Grumpy Old Man permission to do so and how to make it work...

  • Like 1

Share this post


Link to post
Share on other sites
DC2_fnc_createEnemy = compile preprocessFileLineNumbers "server\functions\core\fn_createEnemy.sqf";
// Copied from an A2 project because I am super cool and use CfgFunctions in A3

["Camara", 300, "red", "", [true, 100], [false, 0], [false, 0], [true, 5], [false, 0], [false, 0], 1, ""] spawn DC2_fnc_createEnemy;

If you prefer this old method, use compileFinal as well (A3 0.50).

https://community.bistudio.com/wiki/compileFinal

Your code is run at mission start.

call compile preprocessFileLineNumbers "Scripts\MY_fnc_whatever.sqf";

If this is what you want... You can add arguments (parameters) still.

[ arguments ] call compile preprocessFileLineNumbers "Scripts\MY_fnc_whatever.sqf";

 

  • Like 1

Share this post


Link to post
Share on other sites

Unscheduled scripts called from a scheduled environment such as the init.sqf are still in that scheduled environment.

Your init.sqf therefore waits until "Scripts\MY_fnc_whatever.sqf" is finished before it continues with the sleep and with "Scripts\MY_fnc_whatever_2.sqf".

If that first script takes a long time, you won't see the second script happening.

 

If you want both scripts activated, spawn them instead:

spawn compile preprocessFileLineNumbers "Scripts\MY_fnc_whatever.sqf";
sleep 1;
spawn compile preprocessFileLineNumbers "Scripts\MY_fnc_whatever_2.sqf";

 

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  

×