Saving A Variable's Current # So It Dont Change After Entered Again

i have a variable in witch it is defiend and im trying to make a high score list basicly and i cannot figure out how to save it so it dont reset after re-entry how can i do this?

Comments

  • : i have a variable in witch it is defiend and im trying to make a high score list basicly and i cannot figure out how to save it so it dont reset after re-entry how can i do this?
    :

    Hey Spartacus,

    I usually save my highscores in a file. When the program is loaded again the file is read and the old highscores are loaded.

    To save a variable to a file.

    OPEN "FILENAME.HIS" FOR OUTPUT AS #1
    WRITE #1, name$,score%
    CLOSE #1

    To read it:

    OPEN "FILENAME.HIS" FOR INPUT AS #1
    INPUT #1, name$,score%
    CLOSE #1

    You can save all kinds of info using files. You can even print text files.

    My examples might have an error or two, but that's basicly how to do it.


  • : i have a variable in witch it is defiend and im trying to make a high score list basicly and i cannot figure out how to save it so it dont reset after re-entry how can i do this?
    :

    Hi-yo Sparticus!

    Freind's idea of saving the scores in a file will work even on re-entry to the program. If all you want is to retain the variable value between sub calls, use the keyword STATIC.

    Enjoy!

    Al


  • : i have a variable in witch it is defiend and im trying to make a high score list basicly and i cannot figure out how to save it so it dont reset after re-entry how can i do this?
    :

    Hi-yo Sparticus!

    Freind's idea of saving the scores in a file will work even on re-entry to the program. If all you want is to retain the variable value between sub calls, use the keyword STATIC.

    Enjoy!

    Al


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories