Login
Remember
IF Answers
Ask a Question

# [Inform 7]Timers, daemons, switchon & switchoff

0 votes
51 views
asked Sep 24 in Authoring by One-armed Badger

I'm converting an old Inform 6 game to Inform 7 but am having some trouble finding the new way of doing things.

For example, I previously had a button I could SwitchOn and SwitchOff, but I can't find any topic in the Index that covers the Inform7 way of handling on & off. I tried looking for everything obvious such as "Switches", "Buttons", "On-Off state", "On", "Off", etc, only to find nothing and remain baffled.

To save exasperation, can anyone please help me with:

- Switches - how to turn things on & off
- Timers - how to trigger an event after a certain number of turns; also how to interrupt the timer (StopTimer in I6)
- Daemons - making things happen turn-by-turn, whether "on screen" (e.g. telling the player footsteps are getting nearer each turn) or background stuff (calculating the amount of petrol left as the player drives about).

If someone can kindly tell me what the new equivalents are I can look them up, but any additional information/explanation is appreciated - especially if it is to say "X" doesn't have a direct equivalent, it's now handled by doing Y and Z."

Thanks in advance.

- inform7
- switches
- timers
- daemons
- inform6-conversion

## 1 Answer

+1 vote
answered Sep 24 by bg (692 points)
edited Sep 24 by bg

I don't know whether these are exact equivalents of how things are done in I6, but this is how they are typically done in I7:

Switching on and off:

See §3.14. Devices and descriptions in the manual.

> A "device" is another of the standard kinds of thing, and should be
> used for anything which can be switched on or off: a light switch,
> say, or a slide projector. Devices are generally machines, clockwork
> or electrical. A device is always either "switched on" or "switched
> off", but is switched off unless we specify otherwise.

From the example "Down Below":

    Terrifying Basement is a room. The light switch is a switched on device in the Terrifying Basement. It is fixed in place.

    Carry out switching off the light switch: now the Terrifying Basement is dark.

    Carry out switching on the light switch: now the Terrifying Basement is lighted.

Triggering an event to occur after x turns:

The answers to these questions may help:

http://ifanswers.com/282/how-do-i-print-a-message-on-the-xth-turn-in-inform-7

http://ifanswers.com/340/how-to-trigger-an-event-to-occur-x-turns-after-another-event

I don't know how interrupting a timer is done--hopefully someone else can answer that.

Making things happen turn by turn:

See §9.5. Every turn in the manual.

From that section:

    Every turn when the location is the Orchard, say "The summer breeze shakes the apple-blossom."

## Related questions

- [Inform 7] How to implement a blanket 'not understood' comment for an Inanimate Listener
- Open container that you can't see inside in Inform 7?
- Is there an easy way to loop text in Inform 7?
- Centering an image in Inform 7
- Inform 7: Multiple instances of a kind of thing where some (but not all) change properties

...