if

Category: Script
Since engine version: 1.0 OC

Description

If condition is non-zero the directly following command or script block will be executed.

Syntax

void if(bool condition);

Parameter

condition:
Condition

Example

if(!FindObject(Find_ID(Rock))) CreateObject(Rock);
Creates a rock if no other rocks are present.
if(!FindObject(Find_ID(Rock))) { CreateObject(Rock); CreateObject(Gold); }
Creates a rock and a chunk of gold if no rocks are present.
See also: C4Script, Operators, while
jwk, 2002-04