If player is wearing X AND Y - correct syntax

This should be an easy one, but I can’t work out the syntax.

I need an conditional that is dependant on player wearing both sunglasses AND headphones.

Assuming Inform 7, this is the easiest way:

If the player is wearing the sunglasses and and the player is wearing the headphones

“And” creates a new conditional test, rather than stacking an additional parameter onto the previous test.

(If you’re doing this a lot, it might be cleaner to write up a “To decide whether the player is well-dressed” rule and then just reference that, since manually typing out a bunch of conditionals is the kind of place where it’s easy to make mistakes, especially if you later decide that the headphones need to be repaired before they work, or the player can wear a visor instead of sunglasses, or something like that)

1 Like

Thanks, but what syntakx do I use to make ‘well-dressed’ dependant on wearing both items?

Check out this bit of Writing with Inform for the full discussion, but this should work:

"Test" by Mike Russo

The Cliff is a room.  

The sunglasses are in the cliff.  They are wearable.  They are plural-named.  The headphones are in the cliff.  They are wearable.  They are plural-named.

The description of the player is "[if the player is well-dressed]Snazzy![otherwise]As good looking as ever."

To decide if the player is well-dressed:
	If the player is wearing the headphones and the player is wearing the sunglasses, decide on true.
1 Like

Perfect! Many thanks.

It can also be generalised:

Definition: a person is well-dressed if they are wearing the sunglasses and they are wearing the headphones.
1 Like