Traditionally-written games award points throughout play, as an indication of progress. If we want to be traditional, 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.
Recall that if the source declares:
Use no scoring.
then the SCORE, NOTIFY ON and NOTIFY OFF commands do not work; the final score is not shown at the end of a game; 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" has no visible effect, though it is not actually illegal.
 | In previous builds, Inform had a special phrase for adding to the score:
award (number) point/points
This phrase adds the given value to the score. It is now deprecated, and only ever acted as a shorthand for:
increase the score by (number)
Giving this a special phrase wording tended to suggest to newcomers that there was something special about the score - when, in fact, it was only ever a number that varies, called "score".
|
|
Suppose we want to reward the player the first time he reaches a given room. The "unvisited" attribute is useful for this: unlike such constructions as "going to a room for the first time", it doesn't develop false positives when the player has merely tried to go to the room in question. "Every turn when the player is in a room for the first time" is also unhelpful, because it continues to be true as long as the player is in a room on his first visit there.
"Mutt's Adventure"
Section 1 - Procedure
A room can be scored or unscored.
Carry out going to a unvisited scored room:
increment the score.
Section 2 - Scenario
The Incan Palace Compound is a room. "After numerous false leads through the jungles of Peru, and an arduous trek along the Amazon, you have arrived, at last, here: at Atagon, the lost city of untold treasure."
The startlingly intricate door is a door. It is inside from Incan Palace Compound and outside from the Treasure Room. "A door carved all over with figures of ancient gods, and protected by an assortment of gears and latches, [if open]stands open[otherwise]blocks progress[end if] towards [the other side of the intricate door]."
The description of the Treasure Room is "To your considerable surprise, the treasure room is stocked with art objects from a vast range of eras and geographical locations: beside the expected pre-Columbian gold there are Cycladic figurines, Chinese Tang-dynasty pottery, purses that might have been stolen from Sutton Hoo. [one of]If the British Museum developed a nasty expectorant cough, this is what you'd find in its hanky.[or][stopping]".
The Treasure Room is scored.
Test me with "in / out / in".
|