Jump to content
avibird 1

Can anyone please explain the difference between these two code lines!!

Recommended Posts

Hello both code lines work fine but I was wondering what is the difference between the setup. Is one more efficient then the other or no difference? the code has a slighlyt different setup with parameters. I know with scripting there are many different ways to accomplish something and there is no right way only a wrong way.

 

Mod's/Scripts used are JEBUS and Vcom AI

 

0 = [this,"DELAY=",10,"GAIA_NOFOLLOW=","2","PAUSE=",25,"EXIT=", myExitTrigger6,"INIT=","(group _ProxyThis) setVariable ['Vcm_norescue', true]"] spawn jebus_fnc_main; 

 

 

call{0 = [this,"DELAY=",10,"GAIA_MOVE=","2","INIT=","{doStop _x} forEach (units _proxyThis)","EXIT=",myExitTrigger6,"PAUSE=",25] spawn jebus_fnc_main; }

 

 

 

Staff like this goes over my head lol the color section above what is the difference.

Share this post


Link to post
Share on other sites

The second one is just wrapped in a call, which IIRC is something that CBA does when you paste code into an init field in the editor, and so is how it would appear in your mission .sqm.

 

Called code runs in the current thread which waits for it to complete (and return a value if desired) while spawned code is run in a new thread, released on its own recognizance.

Share this post


Link to post
Share on other sites

So there's no benefit of calling a code one way or the other? Is one more efficient than the other. 

Share this post


Link to post
Share on other sites

Like most things, it depends. In your example, the called code is itself spawning a function, I'm not sure there's much difference performance-wise. 

 

I'm maybe not the best one to explain when and why you might use call or spawn (or neither) but their relative Biki entries as well as the scheduler page might shed some light:

 

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

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

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

  • Thanks 1

Share this post


Link to post
Share on other sites
On 12/24/2021 at 2:22 PM, avibird 1 said:

call{0 = [this,"DELAY=",10,"GAIA_MOVE=","2","INIT=","{doStop _x} forEach (units _proxyThis)","EXIT=",myExitTrigger6,"PAUSE=",25] spawn jebus_fnc_main; }


Looks like you're loading a mission after the  CBA update awhile back.
It was used as a workaround... That's as much as I remember.

You can remove the call brackets. It's not going to improve performance or run jebus any quicker.
 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@Maff So overall there is no performance difference using the first setup of code versus the second setup code using JEBUS. Because I have some groups using the first one and some groups using the second one.  If you guys had a pick which setup would you guys use because I'm a little anal and want to have the same setup using JEBUS. I think most of the time for his examples in his demo and fourm page he uses the the first one.

 

0= [this,"DELAY=",10,"GAIA_NOFOLLOW=","2","PAUSE=",25,"EXIT=", myExitTrigger6,"INIT=","(group _ProxyThis) setVariable ['Vcm_norescue', true]"] spawn jebus_fnc_main; 

 

But have been using this one as well

 

 call{0= [this,"DELAY=",10,"GAIA_MOVE=","2","INIT=","{doStop _x} forEach (units _proxyThis)","EXIT=",myExitTrigger6,"PAUSE=",25] spawn jebus_fnc_main; }

Thanks for the feedback guys.

 

 

Share this post


Link to post
Share on other sites

As we both mentioned, the call wrapper is just something that CBA would add when pasting code into an init field to avoid certain possible errors. There should be no functional difference, and no real-world measurable difference.

  • Like 1
  • Thanks 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

×