SOLVED: Reset Score to 0...

Started by barefoot, Wed 02/02/2011 06:44:06

Previous topic - Next topic

barefoot

UPDATE:

This seems to work:

Code: ags

  game.score=0;


Typical!  Unless you know better..

-----------------------------------------------------




Hi

I have made this a new entry..

Once my game is finished it goes to a credits screen and if the user decides to play again from a Play button the score remains as it was.. what is the best way to reset the score to o..  All the Rooms have been Reset.

I am using the GiveScore (global)

Have tried:
Code: ags

if (HasPlayerBeenInRoom(5))
  game.score=0;


and then:

Code: ags

if (HasPlayerBeenInRoom(14))
    GiveScore(-38950);


But the score could of been anything! I just need it to return to 0

can anyone assist?

cheers

barefoot




I May Not Be Perfect but I Have A Big Heart ..

Khris

Why a second thread...?

Putting game.score and game.total_score in there doesn't make sense if you only use %d once.

If you want to tell the player how much money in total they can collect, you could use this:

Code: ags
  Display("So far you have collected $%d of a total of $%d.", game.score, game.total_score);


See, the first %d is replaced with the value of the first variable, the second %d with the value of the second variable, etc.

barefoot

Hi Khris

Not a second thread, but a slightly different issue..

I used script as it was which included game.score and game.total_score

Also i do not want to display 'collected $%d of a total of $%d'.. which can be useful for other uses.

I just wanted to check what the player has accumulated ($) and then do an if/else function depending on how much he had accumulated.

what I have:

Code: ags
    cfence.Say("I estimate your Grand Total to be: $%d", game.score, game.total_score);


It seems to work ok and of course the possibilities are endless.

thank you for your comments... and i will be looking further into this..

barefoot


I May Not Be Perfect but I Have A Big Heart ..

Khris

You didn't get what I was trying to tell you:
you are listing two variables inside the .Say command but the message contains only one %d.
In other words, you don't need to put game.total_score at the end since it will be ignored.

But since you put it there in the first place I thought you maybe wanted to put that inside the message, too.

barefoot

That makes sense

cheers Khris

barefooy
I May Not Be Perfect but I Have A Big Heart ..

barefoot

#5
UPDATE:

This seems to work:

Code: ags

  game.score=0;


Typical!  Unless you know better..

-----------------------------------------------------

Once my game is finished it goes to a credits screen and if the user decides to play again from a Play button the score remains as it was.. what is the best way to reset the score to o..  All the Rooms have been Reset.

I am using the GiveScore (global)

Have tried:
Code: ags

if (HasPlayerBeenInRoom(5))
  game.score=0;


and then:

Code: ags

if (HasPlayerBeenInRoom(14))
    GiveScore(-38950);


But the score could of been anything! the 38950 was what the player has to have to win. I just need it to return to 0 whatever the players score is..

can anyone assist?

cheers

barefoot
I May Not Be Perfect but I Have A Big Heart ..

Akatosh


SMF spam blocked by CleanTalk