[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.

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."
This site is now closed.
As of 1st November 2015, this site is a read-only archive. For more information see the intfiction forum post

Welcome to IF Answers, a site for questions and answers about Interactive Fiction.

Technical questions about interactive fiction development tools such as Inform, Twine, Quest, QuestKit, Squiffy, Adrift, TADS etc. are all on-topic here.

Non-technical questions about interactive fiction are also on-topic. These questions could be about general IF design, specific games, entering the IF Comp etc.
...