Page 1 of 1

if & else

Posted: April 10th, 2010, 12:29 pm
by Rukariox
I'm creating a script with "if"in it.

so i have

Code: Select all

if(user isTouching(trigger))
//do things//
but i wan't to have something executed if he is not touching the trigger to.
i tried with else { but it gave a script compile error can anyone tell me how to do this?

Re: if & else

Posted: April 10th, 2010, 1:34 pm
by waywaaaard

Code: Select all

if(statement){
 // TODO

}else{
 // TODO

}


or

if(statement){
 // TODO

}else if(statement){

 // TODO
}else{
 // TODO


}

Re: if & else

Posted: April 11th, 2010, 11:37 am
by megazor
or

Code: Select all

if (!statement)
{
   //do stuff
}
"!" means "not", so

Code: Select all

if (!user isTouching(entity))
{
   //do stuff
}