Index    EarthC language


States

User can define as many states as he needs. Current state is called periodically every few game ticks. Current state can be changed using instruction:

return TheNameOfNewState[,delay];  //inside state 
delay is an optional delay (in game ticks) of the next state call (default is 20)

or

state NewStateName; //inside command

typical state declaration:

state StateName

{

}

additionally if you need to reference state X1 in state X2 and state X2 in state X1 you can declare state:

state X1;    //here declaration

state X2
{
    return X1;
}
state X1
{
    return X2;
}

IMPORTANT: First state declared or defined in file becomes current state untill you use any current state changing instruction