# Game maker else checks all ifs?

I have a list of if functions (checking if various spots in the room are empty) in one event. I want to check them ALL with an else statement (if none of the spots are cleared), and display a message. How would I do this?

I do not know about game maker, but if it is as in the other programming languages, you must nest all the ifs, one inside the other.

If there is an object
Start
Create Instance
End
If there is an object
Start
Create Instance
End
//....
Else
Start
Do Something else
End


You should try:

If there is an object
Start
Create Instance
End
Else
Start
If there is an object
Start
Create Instance
End
Else
Start
If there is an object
Start
Create Instance
End
End
Else
Start
Do Something Else.
End
End
//....


Gustavo Maciel wrote right answer. But I want add one more solution (sometime it can be very useful).

Using code it can be something like this:

var result = false;
if (statement)
{
// action 1;
result = true;
}
...
if (statement)
{
// action N;
result = true;
}

// no actions
if !result             // same with: if (result = false)
{
// else action
}


P.S. I advise nevertheless to use a code, but not buttons. Solution of Gustavo Maciel via code:

if position_meeting(pos_x, pos_y, your_object)
{
instance_create(pos_x, pos_y, blockObject);
result = true;
}
else if position_meeting(pos_x, pos_y, your_object)
{
instance_create(pos_x, pos_y, blockObject);
result = true;
}
...
else if position_meeting(pos_x, pos_y, your_object)
{
instance_create(pos_x, pos_y, blockObject);
result = true;
}
else
{
}


Of course, here need to change all coords and object names.

btw,

else if (statement)
{
}


it same with

else
{
if (statement)
{
}
}

• Yep, this is it, but I tried to answer it only using "event" kinda code, like I saw in the Screenshot! If gamemaker has else ifs, then go for it! – Gustavo Maciel Jun 2 '15 at 0:46