Jump to content
Sign in to follow this  
R0T

Control Structures question

Recommended Posts

Hey, short question ! Is it possible to combine a if statement with a for do ???

When I have tried it i got a error. Ok maybe I messed it up with all the {}}{}{}{}{{}}} ;)

So till i try this again is it even possible ? Sorry im very new too this editing !

I have code that is done 6 times in a row and I want the script looks a bit shorter and nicer ;)

Like this :

if (alive player) then

{

if (blabla) then

{

for [{_i=0}, {_i<6}, {_i=_i+1}] do

{

player globalChat format["%1",_i];

};

}

else

{

for [{_i=0}, {_i<6}, {_i=_i+1}] do

{

player globalChat format["%1",_i];

};

};

}

else

{

hint "Blablabla";

};

Share this post


Link to post
Share on other sites

Ok im now i'm at home and Tested it again. Now it works sorry .... Like I said maybe I messed it up with all these [{}{]{]{} :)

Share this post


Link to post
Share on other sites

An advice (I was taught a few weeks ago) : indent your code (if you are new to coding : http://en.wikipedia.org/wiki/Indent_style) and use notepad++ with this http://www.armaholic.com/page.php?id=8680.

This kind of mistakes can take a lot of time to fix when you begin, so we better use all the available tricks to avoid them!

Share this post


Link to post
Share on other sites
An advice (I was taught a few weeks ago) : indent your code (if you are new to coding : http://en.wikipedia.org/wiki/Indent_style) and use notepad++ with this http://www.armaholic.com/page.php?id=8680.

This kind of mistakes can take a lot of time to fix when you begin, so we better use all the available tricks to avoid them!

Thx for the tip ! The notepad is super nice and very helpful.

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  

×