End Game score...?
kelsobrooks
23 Oct 2013, 23:33Wow...What a wonderful medium this is...
Completing my first real educational mini adventure.
When I conclude the game, using the "finish the game" script the game ends but player cannot see the score in the side window?
How would I end the game and actually show it (score) in the screen such as...
Congratulations for finishing you earned 20 out ot 25 total points?
I can show a message, but not sure how to add the score variable?
Thanks

Completing my first real educational mini adventure.
When I conclude the game, using the "finish the game" script the game ends but player cannot see the score in the side window?
How would I end the game and actually show it (score) in the screen such as...
Congratulations for finishing you earned 20 out ot 25 total points?
I can show a message, but not sure how to add the score variable?
Thanks
george
24 Oct 2013, 05:42hi K, the game score variable is called game.score -- I think it's a little tricky because you don't see it in the game attributes when you're creating the game. The status variable gets created when you run the game.
So you can show it by printing a message like Your score is {game.score} .
The wiki is helpful for searching these things, though fair warning some of it is out of date. Most of it is good though.
So you can show it by printing a message like Your score is {game.score} .
The wiki is helpful for searching these things, though fair warning some of it is out of date. Most of it is good though.
HegemonKhan
24 Oct 2013, 18:27in the GUI~Editor mode, you can click on a check box (highlight the "Game" object on the left side's "tree of stuff", and then on the right, under one of the tabs, maybe it's the "Options" Tab ~ I can't remember offhand which tab its under, is the checkbox for toggling on the built-in score scripts) to turn on the built-in score scripting.
you could just create your own score attribute and scripts too:
in-Code:
<game name="blah">
-> // blah scripts
-> <score type="int">0</score>
-> // blah scripts
</game>
in GUI~Editor mode:
Game (Object) -> Attributes (Tab) -> Add ->
Name: score
Type: int // (Integer)
Value: 0
and then you'd just add this script to where you want it to be done:
in GUI~Editor mode:
Run as script -> Add a~new script -> Variables -> Set a variable or attribute ->
Value: whatever number amount (as an integer) you want: ... , -100, -1, 0, 1, 100, ...
(in Code and GUI~Editor:)
Object.Attribute (operator: " = ") Object.Attribute (operator: " + ", " - ", " * ", or " / ") Value
Addition: game.score = game.score + 2
Subtraction: game.score = game.score - 10
Multiplication: game.score = game.score * 4
Division: game.score = game.score / 7
you could just create your own score attribute and scripts too:
in-Code:
<game name="blah">
-> // blah scripts
-> <score type="int">0</score>
-> // blah scripts
</game>
in GUI~Editor mode:
Game (Object) -> Attributes (Tab) -> Add ->
Name: score
Type: int // (Integer)
Value: 0
and then you'd just add this script to where you want it to be done:
in GUI~Editor mode:
Run as script -> Add a~new script -> Variables -> Set a variable or attribute ->
Value: whatever number amount (as an integer) you want: ... , -100, -1, 0, 1, 100, ...
(in Code and GUI~Editor:)
Object.Attribute (operator: " = ") Object.Attribute (operator: " + ", " - ", " * ", or " / ") Value
Addition: game.score = game.score + 2
Subtraction: game.score = game.score - 10
Multiplication: game.score = game.score * 4
Division: game.score = game.score / 7