Login
Remember
IF Answers
Ask a Question

# How do I make this specific code work?

0 votes
72 views
asked Aug 6 in Authoring by Golliat
recategorized Aug 7 by Dannii

The answer this question is related to was meant to solve a problem of mine.
Actually, the answer I got was helpful... for future cases, and I'm sure it was the best I answer I'd get so I gave him the honor(?).
But right now, this code keeps failing.

I have the same error I had in the first question:

I type a verb, the safety check to changes to 5 and displays a message, then I type 'wake children', getting a "Snachala opens her eyes and growls, annoyed.". Then I happily send that command again. Nothing happens.

From there on, the only answer I get is my own helpless command standing atop nothing.

> wake children
> "Snachala opens her eyes and growls, annoyed."
> wake children
> wake children
> etc.

This is the code:

    Safety check is a number that varies. Safety check is 4.

    Your children is an animal in your cave.

    Things have a number called consciousness. The consciousness of a thing is usually 0. Your children has consciousness 0.

    Every turn rule:
    if consciousness of your children is 4,
     move your children to the location of the player;
    if safety check is 4,
    say "Today you must show your children once again the way to the river and teach them where can they eat where they cannot. Gotta wake them up and head outside.";
    increase safety check by one;

    Instead of waking your children:
        if the safety check is less than 4,
        say "You'll have time for that after you make sure no big creature came into the cave. Check for any clues left";
        if the safety check is 5:
            if the consciousness of your children is 0:
                say "Snachala opens her eyes and growls, annoyed.";
            if consciousness of your children is 1:
                say "Kogti turns his head, eyes wide open, startling you.[line break][line break] You always forget the weird way he wakes up.";
            if consciousness of your children is 2:
                say "Nosa wakes up. He scratches her rear and turns her neck various times, making crack sounds.";
            if consciousness of your children is 3:
                say "Detenysh finally pushes himself up and sits lazily on the rock floor.";
            if consciousness of your children is 4:
                say "Woah, calm down, they're awake already!";
            if consciousness of your children is less than 4:
                increase the consciousness of your children by 1;

If this code plays perfectly on your program, I'll asume it's a playfic.com problem.

P.S.: And I swear to god I typed the tabs. They don't seem to display here.
It actually looks like this:

related to an answer for: How do I make 'if's inside 'if's work?

- inform7

## 1 Answer

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

Thanks for pasting in the code. I'm not sure how you have the every turn rule indented, but it seems to work if I indent it this way:

    Your cave is a room.

    Safety check is a number that varies. Safety check is 4.

    Your children is an animal in your cave.

    Things have a number called consciousness. The consciousness of a thing is usually 0. Your children has consciousness 0.

    Every turn rule:
        if consciousness of your children is 4:
            move your children to the location of the player;
        if safety check is 4:
            say "Today you must show your children once again the way to the river and teach them where can they eat where they cannot. Gotta wake them up and head outside.";
            increase safety check by one;

    Instead of waking your children:
        if the safety check is less than 4,
        say "You'll have time for that after you make sure no big creature came into the cave. Check for any clues left";
        if the safety check is 5:
            if the consciousness of your children is 0:
                say "Snachala opens her eyes and growls, annoyed.";
            if consciousness of your children is 1:
                say "Kogti turns his head, eyes wide open, startling you.[line break][line break] You always forget the weird way he wakes up.";
            if consciousness of your children is 2:
                say "Nosa wakes up. He scratches her rear and turns her neck various times, making crack sounds.";
            if consciousness of your children is 3:
                say "Detenysh finally pushes himself up and sits lazily on the rock floor.";
            if consciousness of your children is 4:
                say "Woah, calm down, they're awake already!";
            if consciousness of your children is less than 4:
                increase the consciousness of your children by 1;

But if "increase safety check by one;" is not indented enough, then the safety check keeps increasing beyond 5, and so the rest of the lines in "Instead of waking your children:" never run, because a safety check higher than 5 is not accounted for.

To keep track of the numbers every turn you can temporarily put in a rule like this:

    Every turn:
        say "Consciousness of your children is [consciousness of your children].";
        say "Safety check is [safety check]."

For pasting code on this site, I usually have the best luck if I paste in the code first, then highlight the code and click the { } button.

commented Aug 6 by Golliat (1 point)
AAaaaand...FIXED!!!
It works, thanks!
I freaking love you.

## Related questions

- How do I make 'if's inside 'if's work?
- How do I update code to use version 5 of Glulx Text Effects?
- How do I make a new action in Inform 7?
- How does punctuation work in Inform 7 code?
- I want to make a verb that requires to things at once. How do I do this this? [internet version]

...