check score?

Started by HandsFree, Sat 07/01/2017 19:45:04

Previous topic - Next topic

HandsFree

There's a part of the game that I like to be able to reset.
I've used GiveScore() to add points to the score. But now I want to check what the current score is, and when the section is reset, change the current score to the old one.

So how can I check/change the score without GiveScore?

thanks

Crimson Wizard

#1
IIRC it was game.score variable.

To be frank, simply searching for "score" in the manual would find this.

HandsFree

To be honest, I often can't find things in the manual.
Searching score in the index tab gives no result.
The search tab usually gives links to pages that are so long that it's hard to find anything there (like game global functions).

Anyway, found game.score now and apparently it's read-only, so I can use it to read the current score, but not te reset it to that score.
I suppose I could do something like GiveScore(oldscore - currentscore), if it works with negative numbers, but is it possible to set the score to a scpecific number?

Crimson Wizard

#3
Quote from: HandsFree on Sat 07/01/2017 21:08:37
The search tab usually gives links to pages that are so long that it's hard to find anything there (like game global functions).
If you are using offline manual (chm file) you can click on the page and press Ctrl+F to open "Search text" box. You have to do this on every page from the search list, though.

Quote from: HandsFree on Sat 07/01/2017 21:08:37
Anyway, found game.score now and apparently it's read-only, so I can use it to read the current score, but not te reset it to that score.
I suppose I could do something like GiveScore(oldscore - currentscore), if it works with negative numberes, but is it possible to set the score to a scpecific number?
It's said to be readonly, but technically it can be set. I think the side-effect of setting it by hand is that you won't receive onScore event, and score sound won't play.
But, yes, you should be able to pass negative values to GiveScore and lower it down too.

E: Actually, setting it by hand also won't automatically update GUI labels that have %SCORE% tag on them (I forgot what it was exactly).

SMF spam blocked by CleanTalk