Jump to content


Photo

Save High-Scores


  • Please log in to reply
No replies to this topic

#1 petrerpanduro

petrerpanduro

    GMC Member

  • New Member
  • 6 posts
  • Version:GM:Studio

Posted 15 October 2013 - 03:38 AM

Hello!

 

I'm spanish, if i write something bad, sorry, my english isn't very good as i wanted. 

 

I'm doing a game that the first 10 players appears in the Highscores, it works good. The problem is that when i exit the game and i return to it, the highscore table is empty.

 

I'm very new in GMS. The code that i'm using to save the scores is this one:

ini_open( 'highscore.ini' ); 

ini_write_real('Score','HIGHSCORE1',highscore_value(1))
ini_write_real('Score','HIGHSCORE2',highscore_value(2))
ini_write_real('Score','HIGHSCORE3',highscore_value(3))
ini_write_real('Score','HIGHSCORE4',highscore_value(4))
ini_write_real('Score','HIGHSCORE5',highscore_value(5))
ini_write_real('Score','HIGHSCORE6',highscore_value(6))
ini_write_real('Score','HIGHSCORE7',highscore_value(7))
ini_write_real('Score','HIGHSCORE8',highscore_value(8))
ini_write_real('Score','HIGHSCORE9',highscore_value(9) )
ini_write_real('Score','HIGHSCORE10',highscore_value(10))


ini_write_string('Score','HIGHSCORE1',highscore_name(1))
ini_write_string('Score','HIGHSCORE2',highscore_name(2))
ini_write_string('Score','HIGHSCORE3',highscore_name(3))
ini_write_string('Score','HIGHSCORE4',highscore_name(4))
ini_write_string('Score','HIGHSCORE5',highscore_name(5))
ini_write_string('Score','HIGHSCORE6',highscore_name(6))
ini_write_string('Score','HIGHSCORE7',highscore_name(7))
ini_write_string('Score','HIGHSCORE8',highscore_name(8))
ini_write_string('Score','HIGHSCORE9',highscore_name(9) )
ini_write_string('Score','HIGHSCORE10',highscore_name(10))

ini_close() 

And when i want to see the highscores, i've this one:

ini_open("highscore.ini"); 

if ini_section_exists('Score') 
  {

punt1 = ini_read_real('Score','HIGHSCORE1', '' )
punt2 = ini_read_real('Score','HIGHSCORE2', '' )
punt3 =ini_read_real('Score','HIGHSCORE3', '' )
punt4 =ini_read_real('Score','HIGHSCORE4', '' )
punt5 =ini_read_real('Score','HIGHSCORE5', '' )
punt6 =ini_read_real('Score','HIGHSCORE6', '' )
punt7 =ini_read_real('Score','HIGHSCORE7', '' )
punt8 =ini_read_real('Score','HIGHSCORE8', '' )
punt9 =ini_read_real('Score','HIGHSCORE9', '' ) 
punt10 =ini_read_real('Score','HIGHSCORE10', '' )



 nombre1 = ini_read_string ('Score','HIGHSCORE1',highscore_name(1))
 nombre2 =ini_read_string ('Score','HIGHSCORE2',highscore_name(2))
 nombre3 =ini_read_string ('Score','HIGHSCORE3',highscore_name(3))
 nombre4 =ini_read_string('Score','HIGHSCORE4',highscore_name(4))
 nombre5 =ini_read_string ('Score','HIGHSCORE5',highscore_name(5))
 nombre6 =ini_read_string('Score','HIGHSCORE6',highscore_name(6))
 nombre7 =ini_read_string('Score','HIGHSCORE7',highscore_name(7))
 nombre8 =ini_read_string('Score','HIGHSCORE8',highscore_name(8))
 nombre9 =ini_read_string('Score','HIGHSCORE9',highscore_name(9) )
 nombre10 =ini_read_string('Score','HIGHSCORE10',highscore_name(10))
//}
ini_close();

I know that it gives to punt1 the value of the first one, but i dont know how put it again in the table of highscores.

 

Thanks a lot!


Edited by petrerpanduro, 15 October 2013 - 03:38 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users