# Get thee behind me, monster!

Having a problem getting the message “The monster is right behind you! Better scoot!” stop printing when the monster has fallen into the grave.

[code]The monster is a person.

The monster counter is initially zero.
Every turn when Attic is visited:
if the monster counter is two:
end the story saying “The monster caught up with you and ripped you to shreds. You have died.”;
otherwise if the monster is in the location:
now the monster counter is zero;
increment the monster counter.

Every turn when monster counter is 1: say “[if monster is not in Bottom of the Grave]The monster is right behind you! Better scoot!”[/code]

and

```Instead of jumping while player is in Cemetery: say "[if monster is in Cemetery]You make a hasty leap and grab onto the rope swing. The monster falls into the grave, tries to get out, but realizes the sides of the grave are too high -- and of course, his tremendoous weight means he ain't jumpin' nowhere. You kick your heels, gaining momentum, release the swing and land in the cemetery next to the daffodil. You take another look at the monster and realize he is very unhappy. Wasn't there some kind of warning about that?"; now monster is in Bottom of the Grave.```

Once the monster falls into the grave, the message about him chasing the character should stop, but it doesn’t.

``Every turn when monster counter is 1 and the monster is not in Bottom of the Grave: say "The monster is right behind you! Better scoot!"``

Possibly?

Did this work?

Also, you have a tendency to put “if” choices inside say statements, when (to me) this should be used when there are choices within the say EG ``` say "your bald head is [if a hat is worn]covered[else]exposed[end if]. but the your lovely eyes sparkle" ```.

Whereas IF choices for deciding whether or not to say the thing go before the say.

EG

``````if the elephant is on fire:
say "fetch the engine!"
now the elephant is tasty.
else:
say "what a boring elephant."
endif.``````

I’m finding it makes your code less simple. Not meant as a neg. of you, just my 2c worth.

I wrote the above quite late last night, and I want to clarify that it’s not meant as a criticism of holmes_iv, only a comment about a programming style. Does Inform7 encourage this style? I’m coming from a more “traditional” ‘IF…THEN…ELSE…ENDIF’ side of things.

How do other people write I7?

I would agree with you, RedOrZed. Using the if-statements in the text like that means (in this case) that the description won’t be printed if the monster isn’t there, but all other effects of the rule (such as moving the monster to the grave) will still run.

I would use the bracketed ifs inside the quotes if most of the say is identical except for a bit at the end, but normal if/else kinda structure otherwise. If there are similar conditions with other stuff (e.g., noting items that you have or haven’t searched), I think I would want to give that class of thing a text value, set that in or after the appropriate actions, and then use [value] where appropriate.

Though I don’t think I’ve ever used any language that actually used “endif” as a keyword to mark the end of if statements.