17.39. Review of Chapter 17: Activities

| Chapter 17: Activities |

| 17.39. Review of Chapter 17: Activities

1. An activity is a process that can apply either to one thing or to nothing; every activity allows us to write "before...", "rule for...", and "after..." rules.

In practice, new activities tend to be most useful when

a. we are creating an extension or source that we expect other authors to use, and we want to provide an easy hook by which they can customize our output.

b. we expect to write a lot of special cases to apply to a given situation, and we want the flexibility of rule definitions to describe these special cases.

c. we want to define contexts within the game for use by other activities: for instance, we can write a rule such as

> Rule for printing the name of the spoon while asking which do you mean:
> say "enormous silver spoon"

where the existence of the "asking which do you mean" activity makes it easy for us to tell Inform when to use this special name.

2. Creating new activities:

> Analysing something is an activity.
> Assaying is an activity.

> Analysing something is an activity.
> The analysing activity has a text called first impression.
> Before analysing: now the first impression is "unremarkable".
> Rule for analysing someone: now the first impression is "living tissue".
> After analysing something (called the sample):
> say "Your professional opinion of [the sample] is that it is [first impression]."

> Instead of examining something (called the sample):
> carry out the analysing activity with the sample.

We can then invoke our created activities with phrases such as

> carry out the analysing activity with the pitchblende;
> carry out the assaying activity;

3. Because Inform's predefined activities are so numerous and specialized, we don't repeat all the examples here; it's worth looking back at individual sections to review what the specific activities can do.

Printing and output

> Printing the name of something
> Printing the plural name of something
> Constructing the status line
> Listing contents of something
> Grouping together something

Room descriptions

> Deciding the concealed possessions of something
> Writing a paragraph about
> Listing nondescript items of something
> Printing room description details of something

Darkness

> Printing a refusal to act in the dark
> Printing the announcement of darkness
> Printing the name of a dark room
> Printing the description of a dark room

Parsing

> Deciding the scope of something
> Clarifying the parser's choice of something
> Asking which do you mean
> Supplying a missing noun/second noun
> Reading a command
> Implicitly taking something
> Printing a parser error
> Deciding whether all includes

Starting and ending the game

> Printing the banner text
> Printing the player's obituary
> Amusing a victorious player
> Starting the virtual machine

Previous | Contents | Next