Inform 7 Home Page / Documentation


§16.14. Another scoring example

paste.png To record (T - text) as achieved:
    choose row with a citation of T in the Table of Tasks Achieved;
    if there is no time entry:
        now time entry is the time of day;
        increase the score by the points entry.

The phrase above expects to see a table like this one:

Table of Tasks Achieved

Points

Citation

Time

1

"pride"

a time

3

"anger"

2

"avarice"

4

"envy"

1

"lust"

2

"gluttony"

3

"sloth"

The middle column records the tasks to be achieved, the first column records the points on offer for each: the final column, initially blank, will store the times at which the tasks are first achieved.

Before eating, record "gluttony" as achieved.

The first time we record "gluttony" as achieved, 2 points will be awarded and the time will be logged in the Table, but on all subsequent occasions nothing will happen. So the combination of the phrase and the Table will look after a scoring system based on achieving specific goals (probably not the seven deadly sins, of course). We can, if we choose, use the same system to display a log of recent accomplishments:

repeat through the Table of Tasks Achieved in reverse time order:
    say "[time entry]: [citation entry] ([points entry])."


arrow-up.png Start of Chapter 16: Tables
arrow-left.png Back to §16.13. Topic columns
arrow-right.png Onward to §16.15. Varying which table to look at

***ExampleGoat-Cheese and Sage Chicken
Implementing a FULL SCORE command which lists more information than the regular SCORE command, adding times and rankings, as an extension of the example given in this chapter.