I need a code that every time i beat my record the old record is deleted and the new record is saved

Hi, I wanted to know if someone has a great and simply code to share to save a record into a txt file. I created my game, now the only one thing that i need to really finish it is to found a way to record my result save it on a txt and to recall it at the final state. I know that i've to create an if, like: if(point > "my record, recalled from the txt"){"rewrite the record with point"}; But i don't know how to save my string and how to recall the first string where the record is saved. I need a code that every time i beat my record the old record is deleted and the new record is saved, please help me <3

Answers

  • Answer ✓

    Hey,

    have a look at the functions loadStrings() and saveStrings()

    You will have to convert the loaded strings to a number which you can achieve with int().

    Hope this helps.

  • TY I was trying to create a file and delate it, wasn't thinking of deleting the single string. Worked perfectly!

Sign In or Register to comment.