Jump to content
Sign in to follow this  
nuxil

Question about functions

Recommended Posts

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" tounge2.gif

_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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×