Login
Remember
IF Answers
Ask a Question

# How to cause an event to occur on every turn, but only when the action succeeds?

0 votes
79 views
asked Sep 17 in Authoring by anonymous

Suppose you have something like:

    Every turn when monster is chasing, say "He's coming!"

Out-of-game actions don't trigger this as they aren't considered turns, nor do parser errors like trying to kiss something not animate. But checking inventory does, as well as other actions that have no real "result". How do you specify whether an action should result in a turn or not?

I'm thinking specifically in cases like:

    Instead of cutting apple with something dull, say "Not sharp enough."

I wouldn't want that to take a turn because the player didn't really do anything; they were preempted by the game from taking any real action.

Also, how do I prevent taking inventory from counting as a turn? I want to treat it as a report that refreshed your memory, not an "action" that would actually require time to go by, which is seemingly how Inform views a turn.

- inform

## 1 Answer

0 votes
answered Sep 17 by bg (692 points)
edited Sep 17 by bg

Sorry, I keep fiddling with this to try to get it to work right. But hopefully it gives you some ideas.

If you just want to be able to control when the message appears, you could adjust the message conditions rather than changing whether an action takes a turn. You could try something like this:

    Include After Not Doing Something by Ron Newcomb.

    Did-something is a truth state that varies.
    Did-something is usually true.

    After not doing something:
        now did-something is false;
        continue the action.

    After taking inventory:
        now did-something is false;
        continue the action.

    Every turn:
        if the monster is chasing and did-something is true:
            say "The monster is coming.";
        now did-something is true.

You'd probably have to tweak this to get it to do exactly what you want.

But if you want to actually prevent an in-world action from taking a turn, check out Joseph Geipel's answer to this question:

http://ifanswers.com/378/how-to-make-commands-timeless?show=378#q378

Maybe there's a more direct way to do what you want. If so, hopefully someone else will chime in.

## Related questions

- How to allow an action only if the item is picked up?
- How to trigger an event to occur x turns after another event?
- 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 print a message on the Xth turn in inform 7?
- Forcing the player to be on a vehicle when entering a room

...