Multiple conditions in an if statement?

Hi all–
I purchased Aaron Reed’s book, which has been an amazing resource so far.

However, I can’t find one thing in it, which makes me think it isn’t possible; I need to do a complex if statement.

Essentially the player can prepare a report with two variables.

A sreport is a thing. A sreport can be negative, positive, or neutral. A sreport can be hopeful, hopeless, or pragmatic. A sreport is neutral and pragmatic.

Now, after the player prepares this report, I want to output the report.

say “[if sreport is positive and hopeful]some text here[end if][if sreport is positive and hopeless]some text here[end if]”.

However, this gives me an error:

I’m not sure why Inform thinks this is “too confusing”–Inform accepts that the sreport is neutral and pragmatic initially, so it is confusing to me that it can’t check both values simultaneously. Is there a better way to write this?

You have to say “[if sreport is positive and sreport is hopeful]”. Inform 7 doesn’t allow you to compress compound conditions like “sreport is positive and hopeful”; there has to be a complete condition on either side of the “and.” (Similarly for “or,” which is probably more common.)

EDIT: Also, you probably don’t want “sreport” in there if sreport is a kind. Exactly what you would use depends on the context in which you’re using the text substitution. If it’s the description of the sreport, you probably want “the item described”; if it’s a rule, you probably want “the noun.”

1 Like

Thanks Matt W! That is great.

How do you think I should write it? I’ve called an “sreport” a thing in my code, but that was only to drop it in. Honestly I don’t care if it is a thing or not; it is a digital report the player prepares by answering some questions.

They never get to “pick it up” or take it, it is ephemeral.

Should I define it as something other than “a thing”?

It depends what you’re doing with it.

What Matt said is that, how you have it currently, an sreport is a kind of thing, not a specific thing. So your condition is somewhat like saying “If a door is open…” Inform doesn’t know which door you mean.

Yes. Generally, if you have a kind (of anything) called “foo” in your code, you never want to check on “if foo is…” or even “if the foo is…”; that’ll check on any foo (as if you’d written “if a foo is”), which is usually not what you want.

From what you’re describing, it sounds like you might not even need sreport to be a kind of thing at all. Just code in one sreport, do what you need to do with it, and if the player prepares another digital report you can recycle the same sreport thing. (Though that depends on the details of how you’re implementing it in your code.)

That’s what he’s done. It’s not a kind.

I could’ve sworn (a) that it used to say “An sreport is a kind of thing” and (b) that if that post had been edited after people responded to it, there would be an edit timestamp. Ah well.

I didn’t edit it, but no worries, it’s easy to make that type of mistake :slight_smile: Thanks for the help! It was really useful.

And thanks to Zarf for pointing that out, it helped clear up my confusion.

Thanks all!