|
-
Oct 11th, 2003, 04:45 PM
#1
Thread Starter
New Member
saving record score automatically
I have some games where I save the record score automatically when the user has beat it. My code is as follows:
Private Function BringinRS()
On Error GoTo SetRS
Open "C:\My Documents\Chris Games\Quad2RS.txt" For Input As #1
Input #1, RS
Close #1
Exit Function
SetRS:
RS = 0
Open "C:\My Documents\Chris Games\Quad2RS.txt" For Output As #1
Print #1, RS
Close #1
End Function
Private Function SaveRS()
Open "C:\My Documents\Chris Games\Quad2RS.txt" For Output As #1
Print #1, S
Close #1
End Function
If there is no record score yet, then I set it to 0. When they beat it, the program goes to SaveRS. On some PC's this works fine, like on mine Windows ME. On some, like Windows 98 and XP, when they run the executable of my game, there is a path error. I don't know what to do different so I can save the record score without errors. How else can I do this?
vbsslink
-
Oct 11th, 2003, 05:06 PM
#2
(Like in my other post) use App.Path instead of hardcoding it
Ex:
VB Code:
Private Function BringinRS()
On Error GoTo SetRS
Open App.Path & "\Quad2RS.txt" For Input As #1
Input #1, RS
Close #1
Exit Function
SetRS:
RS = 0
Open App.Path & "\Quad2RS.txt" For Output As #1
Print #1, RS
Close #1
End Function
Private Function SaveRS()
Open App.Path & "\Quad2RS.txt" For Output As #1
Print #1, S
Close #1
End Function
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Oct 11th, 2003, 06:35 PM
#3
Thread Starter
New Member
record score
Thanks jemidiah. The app.path works fine on my PC.
vbsslink
-
Oct 11th, 2003, 06:37 PM
#4
Any time
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|