Login
Remember
IF Answers
Ask a Question

# How do I make 'if's inside 'if's work?

–1 vote
82 views
asked Aug 6 in Authoring by anonymous
recategorized Aug 7 by Dannii

I need help from someone who fully understands Inform 7.

The manual doesn't throw specifics about this.
As you can see, I got:
if [condition] begin;
[a load of 'if' commands]
end if

Inform seems to just read the first command from the whole and ignores the rest.

Which is the problem?

- inform7

## 2 Answers

0 votes
answered Aug 6 by bg (692 points)
edited Aug 6 by bg
Best answer

To answer the question in general ("How do I make ifs inside ifs work"), the if conditions need to be indented or to use "begin." To indent them, you'd do something like this:

    Instead of waking your children:
        if the safety check is less than 4:
            say "You'll have time for that...";
        if the safety check is 5:
            if the consciousness of your children is 0:
                say "Snachala...";

and so on. See §11.7. Begin and end in the Inform manual.

As for your specific case, I haven't tested it because I'm not eager to retype the whole example.

asked Aug 6 in Authoring by Golliat
recategorized Aug 7 by Dannii How do I make this specific code work?
0 votes
answered Aug 7 by aika (3 points)

Firstly, if you paste the code rather than screenshot it'll be a lot easier for us to help you!

Anyway my best guess is that inform is understanding "the consciousness of your children" and "consciousness of your children" as different variables. But that might not be it.

In any case, I would put a line like this right at the start of your rule to help with debugging:

    say "Var 1: [the consciousness of your children] Var 2:  [consciousness of your children].";

## Related questions

- How do I make this specific code work?
- How do I make a new action in Inform 7?
- When using hyperlinks, how do you make the command appear appear next to the > instead of on the following line? (Inform 7)
- How do I get the Inanimate Listener to respond to "Computer, hello"?
- How to get rid of a rule that's blocking what I want the player to do? (Inform 7)

...