Multipart 'if' statements in descriptions

Thanks in advance.

I’ve tried searching the documentation, and have found a way of doing some of what I want, but I need a way include complex descriptions. I’ve included “The Fancy Examining Rule” code from exercise 324 (Crusoe):

[code]Chapter 2 - The Fancy Examining Rule

The fancy examining rule is listed instead of the standard examining rule in the carry out examining rules.

Printing the description of something is an activity.

This is the fancy examining rule:
carry out the printing the description activity with the noun;
rule succeeds.

Rule for printing the description of something (called item):
if the description of the item is not “”:
say “[description of item] [run paragraph on]”;
otherwise:
say “You see nothing special about [the item]. [run paragraph on]”.

Last after printing the description of something:
say “[paragraph break]”.
[/code]

This code does some of what I want, but I want the description to accumulate - ie if the player is wearing more than one of the following then print the sentence pertaining to all the items the player is wearing. I have the following code:

The description of the player is "Short, you stand just 5 foot in your bare feet.  [if the player is wearing the shoes]Though, of course, you're not.  [otherwise if the player is wearing the dress]Your plain brown dress covers you decently from neck to knee.  [otherwise if the player is wearing the trousers]Your legs are clad in lose fitting trousers.  [otherwise if the player is wearing the shirt]  The shirt hangs down to your thighs.  [end if]"

Obviously the ‘otherwise’ blocks printing more than one thing. How would I work this?

EG I want the description of the player, if she’s wearing the dress and the shoes to be:

x me

Short, you stand just 5 foot in your bare feet. Though, of course, you’re not. Your plain brown dress covers you decently from neck to knee.

I couldn’t find any way of having more advanced descriptions (but then maybe I was looking in the wrong place). Cheers!

You can perhaps just skip the else- ifs and use a series of independent ifs:

The description of the player is "Short, you stand just 5 foot in your bare feet.[if the player is wearing the shoes]  Though, of course, you're not.[end if][if the player is wearing the dress]  Your plain brown dress covers you decently from neck to knee.[end if][if the player is wearing the trousers]  Your legs are clad in lose fitting trousers.[end if][if the player is wearing the shirt]  The shirt hangs down to your thighs.[end if]"

facepalm

Damn it! I’ve been wrestling with that for way too long. Thanks Felix, that does it. I would promise not to use this new ability for evil, but I’m pretty sure I’ve already crossed the line.

PS - Are you the same Felix who recommended “Winter’s Oasis” on the other forum?

You can also do this via the printing the description of something activity like this.

[code]“Test”

The fancy examining rule is listed instead of the standard examining rule in the carry out examining rules.

Printing the description of something is an activity.

This is the fancy examining rule:
carry out the printing the description activity with the noun;
rule succeeds.

Rule for printing the description of something (called the item):
if the description of the item is not “” begin;
say “[the description of the item] [run paragraph on]”;
otherwise;
say “You see nothing special about [the item]. [run paragraph on]”;
end if.

After printing the description of the player:
if the player is wearing the shoes, say "Though, of course, you’re not. ";
if the player is wearing the dress, say "Your plain brown dress covers you decently from neck to knee. ";
if the player is wearing the trousers, say "Your legs are clad in lose fitting trousers. ";
if the player is wearing the shirt, say "The shirt hangs down to your thighs. ".

Last after printing the description of something:
say paragraph break.

The Testing Room is A Room. The player wears some shoes, some trousers, a dress and a shirt. The description of the player is “Short, you stand just 5 foot in your bare feet.”.

Test me with “x self / drop shoes / x self / drop trousers / x self / drop shirt / x self / drop dress / x self / wear trousers / x self / wear shoes / x self / wear dress / x self / wear shirt / x self”.[/code]

This can allow for more complex descriptions with nested if statements and the like.

Hope this helps.

No, that would be Felix Pleșoianu, who is also the Felix of the ifMUD and for all purposes the Real Felix.
(I am the Other Felix and was pretty new to the IF community when I registered here–new enough to be unaware of the First Felix or I would not have stolen his name like that.)

I’m not so sure about that! :wink:

I’d consider you to be the “real” Felix, especially since you have more presence here. :slight_smile: