nuxil 2 Posted March 14, 2007 Hi all scripters.. im just starting to learn sqf. and i am wounderin about functions.. can i do it somelike i can in "bash" , "for thouse who know what that is" _myfunction1() { some code ; some more code; } ; _myfunction2() { some code ; some more code; } ; if (this == that) then { _myfunction1;} else { _myfunction2;}; i dont know how to explain it otherwise, anyone understand what i mean,, and is it posseble ? Share this post Link to post Share on other sites
bibblebabble 0 Posted March 14, 2007 Have a look at the compile and call commands Share this post Link to post Share on other sites
sbsmac 0 Posted March 14, 2007 Yes you can:- <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> f1 = { player sidechat format ["f1 %1",_this select 0] ; }; f2 = { player sidechat format ["f2 %1",_this select 0]; }; player sidechat "calling f1 then f2"; ["function 1"] call f1; ["function 2"] call f2; To get this to work, put it in an sqf file, then call compile preprocessfile "f.sqf" ; Share this post Link to post Share on other sites