Scripts that wait

ReadingThings that happen

So far, every script began with when I start. The steps ran as soon as the game began. But a game is full of things that happen later. The hero walks up. Someone gets hit. A character lands from a jump.

A script can wait for those things. This is how.

Events

Something that happens in the game is called an event. A when line names the event to wait for.

when I see the {Hero}
  say "Who goes there?"
  jump

This guard does not shout at the start of the game. It waits. The steps under the when line run only when the guard sees the hero.

A rule

A when line and the steps under it make a rule.

PartWhat it does
The when lineNames the event to wait for.
The steps under itWhat to do when the event happens.

A rule can wait for a long time. If the event never happens, its steps never run.

What is {Hero}?

The curly brackets mean "this is the name of something in the game". {Hero} is the hero, whoever is playing.

Finish this section

Tick Finished reading at the bottom of the page. Then press Next to meet a guard who is fast asleep.