Results 1 to 5 of 5

Thread: Again..? on simple game

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2000
    Posts
    33

    Lightbulb

    Me Again.. On the Simple Craps Game.
    Ok. I have everything set corrcetly on how I want it. High Score Works But! When you Close the Game and Start it back up again theres no set High Scores. How can i set the Score to a .scr file or any other way. This is want I did for Saving the High Scores during Game Play:

    ------Module Code------
    Public Type Game
    IntName As String
    IntCash As Integer
    IntWins As Integer
    IntLost As Integer
    IntGames As Integer
    End Type
    ------END MOD----------

    Below is the Setting On the Main Form
    I have other settings but Im going to Place just what I
    have for Setting the High Scores

    -----frmCraps-----------

    Dim Scores(1 To 100) As Game 'Arrays 1 to 100 Players
    Dim Players As Integer
    Dim MaxCash As Integer
    Players = 0

    'The High Score gets set when Player's Cash Hits 0
    'And gets sent to GameLoss
    Private Sub GameLoss()
    'Removes Cash from Bank
    Cash = Cash - Bet
    lblCash = Cash 'Sets Cash for Bet
    txtBet.Locked = False 'Unlocks Place Bet

    'Adds a Loss to Game Stats
    NumLose = NumLose + 1
    lblNumLose.Caption = NumLose

    Call GamesPlayed(NumWin, NumLose)

    'Random Phrases for Game Over
    Dim Phrase2 As Integer
    If Cash = 0 Then
    Phrase2 = Int((5 - 1 + 1) * Rnd + 1)
    cmdStart.Enabled = False 'Forces Player to Start New Game
    Select Case (Phrase2)
    Case 1:
    lblStatus.Caption = "Your Broke, Go Home!"
    Case 2:
    lblStatus.Caption = "Game Over, Play Again!"
    Case 3:
    lblStatus.Caption = "Busted, Play Again?"
    Case 4:
    lblStatus.Caption = "Kinda Like Vegas, HUH!"
    Case 5:
    lblStatus.Caption = "Need A loan?"
    End Select

    Call HighScore

    End If

    End Sub


    Private Sub HighScore()
    frmScores.Visible = True
    Players = Players + 1

    Scores(Players).IntName = InputBox("Enter Your Name")
    frmScores.listName.AddItem (Scores(Players).IntName)

    frmScores.listPlayerCash.AddItem (MaxCash)
    Scores(Players).IntCash = MaxCash
    frmScores.listWins.AddItem (frmCraps.lblNumWin.Caption)
    Scores(Players).IntWins = frmCraps.lblNumWin.Caption
    frmScores.listLost.AddItem (frmCraps.lblNumLose.Caption)
    Scores(Players).IntLost = frmCraps.lblNumLose.Caption
    frmScores.listGames.AddItem (frmCraps.lblNumGame.Caption)
    Scores(Players).IntGames = frmCraps.lblNumGame.Caption
    End Sub

    ------------End Code------------

    The High Score form when closed gets
    frmScore.visible = false
    So that no info is lost. I would like it set to something so when the user is done playing and closes. then comes back to play again Users Old High Score is still there along with Other info Set.

    ???
    Thanks



  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Drop the Data into...

    Drop the data into a file...

    in mod...

    Type GameData
    Score as integer
    otherVar as whatever
    etc. etc.
    end type

    in form

    Dim Data as GameData

    Private sub Form_Load()
    Open "C:\Filename" for random as #1
    Get #1,1,Data
    Text1.text = Data.Score
    Text2.text = Data.otherVar
    etc
    etc...(just put the data whereyou want it here)
    Close #1
    end sub

    to write it....
    do it on form unload...
    the reverse a few things:

    Open....
    Data.Score = new high score
    etc..
    Put #1,1,Data
    close #1

    Hope this helps...had to do this quick...about to head out.
    nice and easy...(but the file will be editable in notepad)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2000
    Posts
    33

    Talking Cool I'll try it

    Any no worries on the editable in note book most people wont try that.. Im also making a cheat key for Extra! Cash!!

    Cool.. Anyways Thanks again..

  4. #4
    Addicted Member Ramandeep's Avatar
    Join Date
    Feb 2000
    Posts
    158
    Save the hight score in the windows registry at form unload and get it at form load.

  5. #5
    Addicted Member Ramandeep's Avatar
    Join Date
    Feb 2000
    Posts
    158
    Save the high score in the windows registry at form unload and get it at form load.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width