Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
tophe

Script handles..

Recommended Posts

Hello.

I'm just curious...

If you have a script with loops that you run on a large amount of units. Does it matter if all units use the same "handle"?

For example, could I put this in the init of, say 60 cars:

car = [this] execVM "repair.sqf"

Could I put the exact same init on all of them? Or should I go:

car1 = [this] execVM "repair.sqf"

car2 = [this] execVM "repair.sqf"

car3 = [this] execVM "repair.sqf"

etc.

I have no need to check the handle.

I just want to make sure the server doesn't get messed up or delayed because it is updating the same variable with 50 instances of the same script, simultaneously...

Edited by Tophe

Share this post


Link to post
Share on other sites

As long as you don't need to reference them it shouldn't matter. I do this all the time (tbh I can't imagine when I'd ever need to reference such a thing). I doubt it will mess with the server's performance. At least I've never noticed anything of the sort.

Share this post


Link to post
Share on other sites

First of all, as long as you don't check with a command like scriptDone if a script has ended you can use whatever handle (even the same handle name) you want.

Beginning with A2 you can even use "private" variables as script handles in vehicle inits.

So something like this

_handle = [] execVM "somescript.sqf"

in a vehicle init is totally ok now.

If you start a sqf script from another script you don't even need the handle, so either

[a,b,c] execVM "myscript1.sqf";

or

execVM "myscript2.sqf";

is fine.

Xeno

Share this post


Link to post
Share on other sites

Thanks! That's just what I needed to know... (even if it leaves me a bit downhearted... Now I need to find something else causing problems in my script :P )

Share this post


Link to post
Share on other sites

60 cars? You might want to consider a single script that handles all the cars instead of having 60 scripts running.

Share this post


Link to post
Share on other sites

I think I might have solved the problem now... Did a random sleep in the loop so that the scripts don't restart all at the same time. Works much better.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×