Coyota 10 Posted December 16, 2010 I have been cleaning and compressing one of my scripts shorter. Call seemed like handy way to shave off big bunch of lines from the script. Script is working just fine but im wondering if theres any point using call like this. Reveal hidden contents _wpset = { _this setWaypointBehaviour "AWARE"; _this setWaypointCombatMode "RED"; _this setWaypointSpeed "NORMAL"; _this setWaypointCompletionRadius 20; _this setWaypointStatements ["true",""]; }; _crgwp1 = _group addWaypoint [_startwp, 0]; _crgwp1 setWaypointType "MOVE"; _cgrwp1 call _wpset; I mean is it worth it? Let's say i cut script way shorter with this. Does the use of call actually make it worse compared to just having all the lines? Is it just matter of personal preference? Or is it even nono to use call like this? These might be "stupid questions" but curiosity got me here. Share this post Link to post Share on other sites
shuko 59 Posted December 16, 2010 No harm done doing it like that, I do it as well. It's very nice when you have to run same code more than once. Share this post Link to post Share on other sites
sbsmac 0 Posted December 16, 2010 You've just discovered functions - generally a good thing. In fact, if you give _wpset a global name like "Coyota_wpset" you can even call if from other scripts. :) Share this post Link to post Share on other sites
Muzzleflash 111 Posted December 16, 2010 I put lot of similar functions in one file, or use it to "package" a script so it's easier to use without having to put to use. Share this post Link to post Share on other sites
RazorX 10 Posted December 17, 2010 (edited) When using a "package" of functions like you said above, it would be more professional to also describe them in description.ext (cfgFunctions). But I also found call command useful while converting sqs scripts to sqf. When I wanted to convert goto loops and it was important to operate in one script and use only normal loops and no recursion. Edited December 17, 2010 by RazorX Share this post Link to post Share on other sites