Interactive Fiction_6 – Scoring

SCORING
Interested in using scoring? Then read on.
First determine what the maximum score a player could achieve in your game. Let us say that the maximum score is 100.
Then include this at the beginning of your code:
The maximum score is 100.
 .
To award the player points do one of these commands:
Award 10 points.
– increases the player’s score by 10 points
Award -10 points.
– deducts the player’s score by 10 points.
 .
Usually we implement the award command with an after rule:
After inserting the apple into the fruit bowl:
award 10 points.
 .
This will produce the following during play:
>put apple in bowl
You put the apple into the fruit bowl.
[Your score has just gone up by ten points.]
 .
**The player can check the status of their score at anytime by typing ‘score’.**
 .
There is a big problem here.  The player is able to repeat putting that apple into the fruit bowl and receive 10 points each time. Not the effect we’re looking for.
Here is how we prevent the player from doing that:
After inserting the apple into the fruit bowl for the first time:
award 10 points.
 .
The inclusion of the phrase ‘for the first time’ in the after rule will award points only if this is the first time the player has completed the action.
 .
The Every Turn Rule
Now, how do we know when the player has reached 100 points? And then what happens next?
 .
To monitor the status of the score throughout the game we use the ‘every turn’ rule:
Every turn:
if score is 100 then end the game saying “Congratulations you have achieved a perfect score!”.
 .
This rule checks the score on each and every turn. Then, if the score is equal to the maximum score (in this case, 100) the game ends with a custom message.

____________________________________________________________________________________________________
ASSIGNMENT
After working through the above examples…

Using Inform 7 or www.playfic.com create a story that has:
     Scoring.
     An every turn rule (to check scoring).

Copy and past your working code into notepad and hand in your code.
____________________________________________________________________________________________________

This resources is from –  http://www.hpiweb.com/newmedia/  
There are several good resources on this site.  In particular there are some really useful snippets of code. 

Leave A Reply

Your email address will not be published. Required fields are marked *