Working on update...
Edit: Here is the update, this one will work better.
Rem Project: SaveGameExample
Rem Created: 4/20/2005 5:33:01 PM
Rem ***** Main Source File *****
` Delclare 2 varibles, these will be saved and loaded
Lives As Integer
Score As Integer
` Get the game data from the user
Input "Enter the number of lives: ", Lives
Input "Enter the score: ", Score
` Load the images for the buttons
Load Image "Load.bmp", 1, 1
Load Image "OverLoad.bmp", 2, 1
Load Image "Save.bmp", 3, 1
Load Image "OverSave.bmp", 4, 1
` The load button
Sprite 1, 10, 10, 1
Sprite 2, 10, 10, 2
` The save button
Sprite 3, 10, 45, 3
Sprite 4, 10, 45, 4
` Hide the mouse over sprites, sprites 2 and 4
Hide Sprite 2
Hide Sprite 4
` File exist string
FileNotExist As String
Sync On : Sync Rate 60
Do
` If the mouse is over the load button
If MouseX() >= 10 And MouseX() <= 120 and MouseY() => 10 And MouseY() <= 40
Show Sprite 2
` If the left mouse button is clicked
If MouseClick() = 1
` Load the game data
` If the file exist, load the data
If File Exist("Data.txt")
FileNotExist = ""
Open To Read 1, "Data.txt"
` Read the lives and store in 'Lives' varible
Read Word 1, Lives
` Read the score and store in 'Score' varible
Read Word 1, Score
` Close the file
Close File 1
Else
` If the file does not exist
FileNotExist = "File does not exist!"
EndIF
EndIf
else
` Mouse is not over the button
Hide Sprite 2
EndIf
` If the mouse is over the save button
If MouseX() >= 10 And MouseX() <= 120 and MouseY() => 45 And MouseY() <= 75
Show Sprite 4
` If the left mouse button is clicked
If MouseClick() = 1
` If the file exist
If File Exist("Data.txt")
` Delete the file then save the data
Delete File "Data.txt"
` Save the game data
Open To Write 1, "Data.txt"
` Write the number of lives
Write Word 1, Lives
` Write the score
Write Word 1, Score
` Close the file
Close File 1
Else
` Same as the above save but the file does not
` exist, so just save the game data...
Open To Write 1, "Data.txt"
Write Word 1, Lives
Write Word 1, Score
Close File 1
EndIF
EndIf
else
` Mouse is not over the button
Hide Sprite 4
EndIf
` Display the game data
Text 10, 90, Str$(Lives)
Text 10, 105, Str$(Score)
Text 10, 125, FileNotExist
Sync
Loop
Soon to come... Dark IDE, New IDE for DarkBASIC Pro!