Save Game Info and Read Info Later

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • I Hate My Computer
    New Member
    • Mar 2007
    • 44

    Save Game Info and Read Info Later

    Hi,
    I was wanting to make a game with the ability to save the level and the score. I would also like it to be able to load that saved game. Lastly I would like it to be able to save a high score list and display it later. If you can help I need this before 5/28/07.

    Thanks

    Quick help is greatly appreciated!
  • SammyB
    Recognized Expert Contributor
    • Mar 2007
    • 807

    #2
    Originally posted by I Hate My Computer
    Hi,
    I was wanting to make a game with the ability to save the level and the score. I would also like it to be able to load that saved game. Lastly I would like it to be able to save a high score list and display it later. If you can help I need this before 5/28/07.

    Thanks

    Quick help is greatly appreciated!
    Haven't we done this before ;)
    To quote Killer from last time:
    "Sounds an interesting idea. I hope it works out.

    However, we generally expect people to work out what they want to do, and make some attempt at it. Then, when you have specific questions about points where you get stuck we can help with the how.

    What have you achieved so far on this project?"

    Is this still in VBA?

    Comment

    • I Hate My Computer
      New Member
      • Mar 2007
      • 44

      #3
      Originally posted by SammyB
      Haven't we done this before ;)
      To quote Killer from last time:
      "Sounds an interesting idea. I hope it works out.

      However, we generally expect people to work out what they want to do, and make some attempt at it. Then, when you have specific questions about points where you get stuck we can help with the how.

      What have you achieved so far on this project?"

      Is this still in VBA?
      This is now VB Express 2005.

      So far I have found this code:

      Code:
      Dim TextVar As String
      
      Sub Form_Load()
      
      End Sub
      
      Sub Command1_Click()
      TextVar = Text1.text'Saves the text string into a variable
      Open "AnyFileYouWant.TXT" for output as #1
      Write #1, TextVar'or you can save without having quotes in your file
      'by replacing the word write with the word print
      'but you can only save a line not a whole bunch of lines
      close #1
      
      End Sub
      
      Sub Command2_Click()
      Open "AnyFileYouWant.txt" for input as #1
      do until EOF(1)
      input #1, TextVar
      text1.text = TextVar
      loop
      close #1
      End Sub
       
      Sub Text1_Change()
       
      End Sub
      I don't understand where this saves the file. Can anyone tell me? I also want to know if using this code if I can save different text boxes on different lines and only overwrite certain lines.

      Comment

      • SammyB
        Recognized Expert Contributor
        • Mar 2007
        • 807

        #4
        You'll need to use StreamWriter's and StreamReader's in .Net. It's explained at http://support.microsoft.com/kb/304427

        Comment

        Working...