Maurdekye 10 Posted August 27, 2014 Both commands seem to do exactly the same thing, and I'm not sure why there are two separate ones. Share this post Link to post Share on other sites
sxp2high 22 Posted August 27, 2014 spawn creates a new thread/vm (virtual machine) call executes code within the same thread call { sleep 5; }; hint "This will be shown after 5 sec."; [] spawn { sleep 5; }; hint "This will be shown instantly."; Local variables are also to be considered. That's why local variables in called code should be made private. _test = 123; call { hint format[" %1", _test]; }; // Will display 123 hint format[" %1", _test]; // Will display 123 _test = 123; call { private ["_test"]; _test = 456; hint format[" %1", _test]; // Will display 456 }; hint format[" %1", _test]; // Will display 123 _test = 123; [] spawn { _test = 456; hint format[" %1", _test]; // Will display 456 }; hint format[" %1", _test]; // Will display 123 Has been asked recently here. Share this post Link to post Share on other sites
Maurdekye 10 Posted August 27, 2014 Thanks for the explanation. I kind of had that sort of idea already, but I wasn't absolutely sure. Share this post Link to post Share on other sites
bangabob 41 Posted August 28, 2014 Calls can also be used to return values. This function will return half of any number input. My_fnc= { _N=(_this select 0); _N=_N * 0.5; _N }; _newVal = [5] call my_fnc; Hint str _newVal; Share this post Link to post Share on other sites