What's a good adventure game without a score? Scores are an essential part of any game. This chapter will teach you how to handle them.
Scores are very easy to handle with SCI. The score bar and score variables are all set up in the main script.
First you need to open the main script. Open the game and the Game Explorer will load.
Next, click on the script folder and the list of scripts in your game will appear on the right, along with a preview of the first script. |
Scroll down the list until you see the "Main" script. Double click on it, and the script editor will open up with it. |
The score revolves around two global variables: gScore and gMaxScore.
If you scroll down the list of global variables (main's local variable block), you will find the score variables.
These are the score variables. The gScore variable contains the current score. The gScore variable contains the game's maximum score. Finally, when you add to the player's score, the previous score is stored in gOldScore.
To set the game's maximum score, simply change gMaxScore's value from 0 to whatever your game's score will be.
Updating the score is incredibly simple. You just make a call to the game class' changeScore() method.
Example:Code:(send gGame:changeScore(3))Adds 3 to the score. If gScore was 5, for example, it would now be 8.
You naturally won't want your game's score bar to say "Template Quest". This being the case, you can change it easily by scrolling down to the StatusCode instance and change the text in the Format() kernel call.
That sums up the scores! In the next chapter, you will learn about using the death handler!
< Previous: Chapter 21 - Creating and Using Doors Next: Chapter 23 - Using The Death Handler >Top
You can help keep The Sierra Help Pages and its affiliates alive by helping to defray some of the costs of hosting this site. If it has been of help to you, please consider contributing to help keep it online.Thank you.
The Sierra Help Pages | Sierra Game Help | Walkthroughs | Hints, Tips & Spoilers | Utilities | Links | SHP Forums | Search
© 2013 to present The Sierra Help Pages. All rights reserved. All Sierra games, artwork and music © Sierra.