Multiple If Statements

I will use the following as an example:

If the player eats AND showers before opening the front door, when he opens the front door he will be prompted a certain question asking about whether the player wants to be teleported somewhere or not.

If the player ONLY eats or ONLY takes a shower before opening the front door, when he opens the front door he will be prompted a certain question asking about whether the player wants to be teleported to a second place or not.

If the player does NOT eat or take a shower before opening the front door, when he opens the front door he will be prompted a certain question asking about whether the player wants to be teleported to a third different place or not.

What would the code look like for the multiple if statements?

1 Like

well, I hope there’s no debate about when one must us if… elseif or case… select, but generally speaking, there’s two boolean variable, a perfect match for an if… elseif.

WI 11.5 “conditions and question” should explain how to implement your “asking a certain question”, after this, is a simple matter of checking the pair of boolean variables set after eating and taking shower.

IIRC, there was also a debate here about handling Take in the very specific case of “taking a shower”. an hot-water debate, IIRC…

Best regards from Italy,
dott. Piergiorgio.

1 Like

Dunno effect of your showering or eating actions, but If you’re just asking specifically for if…else syntax in this case

"test" by Ade

Yourself can be clean or dirty.

Yourself can be hungry or fullup.

When play begins:
	now the player is clean;
	now the player is fullup.
	
The kitchen is a room.

The kitchen door is in the Kitchen. 

Before opening the kitchen door:
	if the player is clean AND the player is fullup:
		say "Question about teleport to first place.";
	else if the player is clean OR the player is fullup:
		say "Question about teleport to second place.";
	else if the player is dirty AND the player is hungry:
		say "Question about teleport to third place.".

(you don’t need 3rd if…but just for syntax…!!)

2 Likes