Change description of player based on clothing

I’m struggling to change the player description (ie after ‘examine me’) based on whether the character is wearing different items.

So far I have:

Instead of examining the player:
say “You are Pascal, king among cats.”

Instead of examining the player when the player is wearing the hat:
say “You are Pascal, king among cats. Now with a jaunty hat.”

However, I also have a pair of boots in the story and I’d like to change the description so it says something different if the player is wearing the boots, and if they are wearing the boots and the hat at the same time. I can’t work out how to do this, any help much appreciated!

2 Likes

You probably want something like this:

The description of yourself is "You are Pascal, king among cats[if the player wears something]. Now wearing [a list of things worn by the player][end if]."

(The odd punctuation placement is just to ensure that the description ends in a stop, which helps Inform get the spacing right.)

(Writing a description of the player is a more idiomatic way of going about things than an Instead rule, though either works. If you let it do its thing, the examining action just prints the description of the thing examined.)

It may be that you want the hat to appear as “hat” normally, but “jaunty hat” when describing the player wearing it. This sort of thing can be done with “printing the name of” rules. In this case:

Before printing the name of the hat when examining yourself: say "jaunty ".
1 Like

The brute-force solution works fine:

Instead of examining the player:
	say “You are Pascal, king among cats.”

Instead of examining the player when the player is wearing the hat:
	say “You are Pascal, king among cats. Now with a jaunty hat. But with bare paws. Feet. Whatever.”

Instead of examining the player when the player is wearing the pair of boots:
	say “You are Pascal, king among cats. Now with sweet boots. But with nothing on your head.”

Instead of examining the player when the player is wearing the hat and the player is wearing the pair of boots:
	say “You are Pascal, king among cats -- now fully arrayed.”

Note that you can’t shorten the last one to “the player is wearing the hat and the pair of boots”. You have to write it out.

This gets unwieldy with three items – you’d need eight rules. But you can if you want to.

1 Like

Both of these work perfectly, thank you both!