§9.2. Awarding points

Traditionally-written stories award points throughout play, as an indication of progress. If we want to be traditional, we must first write:

Use scoring.

Without this, the SCORE, NOTIFY ON and NOTIFY OFF commands do not work; the final score is not shown at the end of a story; and the status line above the player's text area shows only the turn count, not (as is more usual) both the score and the turn count. Changing the "score" (see below) has no visible effect, though it is not actually illegal.

With "Use scoring" in place, we can award points as follows:

increase the score by 5;

substituting whatever number we feel is appropriate. We should be careful not to give out the same points over and over, that is, not to reward the same basic achievement many times over if the player simply repeats the same action. This, for instance, is open to abuse:

After taking the trophy:
    increase the score by 5;
    say "Well done!"

The player may simply take the trophy, drop it again, take it again, ... and win five points every time around. We can prevent this by phrasing the rule more carefully:

After taking the trophy when the trophy is not handled:
    increase the score by 5;
    say "Well done!"

Rather than being an open-ended scoring system, IF normally has a maximum possible score, which can be specified with a sentence like so:

The maximum score is 10.

The score and maximum score are just numbers that vary, so we can freely change them:

After eating the poisoned mushroom:
    now the score is -100.


arrow-up.pngStart of Chapter 9: Time
arrow-left.pngBack to §9.1. When play begins
arrow-right.pngOnward to §9.3. Introducing tables: rankings

**ExampleMutt's Adventure
Awarding points for visiting a room for the first time.

Suppose we want to assign scores for a whole range of objects the player might pick up. One systematic way to do this would be with a table of point values for things:

paste.png "No Place Like Home"

Use scoring.

The Hall of the Gnome King is a room. The emerald cow is a thing in the Hall of the Gnome King. The ivory chessman is a thing in the Hall of the Gnome King. The book of incantations is a thing in the Hall of the Gnome King.

Table of Point Values

item

score

cow

10

incantations

4

chessman

1

Report taking an item listed in the Table of Point Values:
    increase the score by the score entry;
    blank out the whole row.

Test me with "take all".

"Blank out the whole row" removes the line from the table, so that each award will occur only once. The player will not be able to earn more and more points by dropping and taking the same item again.

***ExampleNo Place Like Home
Recording a whole table of scores for specific treasures.

Suppose we want to assign scores for a whole range of objects the player might pick up. One systematic way to do this would be with a table of point values for things:

paste.png "No Place Like Home"

Use scoring.

The Hall of the Gnome King is a room. The emerald cow is a thing in the Hall of the Gnome King. The ivory chessman is a thing in the Hall of the Gnome King. The book of incantations is a thing in the Hall of the Gnome King.

Table of Point Values

item

score

cow

10

incantations

4

chessman

1

Report taking an item listed in the Table of Point Values:
    increase the score by the score entry;
    blank out the whole row.

Test me with "take all".

"Blank out the whole row" removes the line from the table, so that each award will occur only once. The player will not be able to earn more and more points by dropping and taking the same item again.

Suppose we want to assign scores for a whole range of objects the player might pick up. One systematic way to do this would be with a table of point values for things:

paste.png "No Place Like Home"

Use scoring.

The Hall of the Gnome King is a room. The emerald cow is a thing in the Hall of the Gnome King. The ivory chessman is a thing in the Hall of the Gnome King. The book of incantations is a thing in the Hall of the Gnome King.

Table of Point Values

item

score

cow

10

incantations

4

chessman

1

Report taking an item listed in the Table of Point Values:
    increase the score by the score entry;
    blank out the whole row.

Test me with "take all".

"Blank out the whole row" removes the line from the table, so that each award will occur only once. The player will not be able to earn more and more points by dropping and taking the same item again.