|
-
Apr 3rd, 2006, 12:22 PM
#1
Thread Starter
Addicted Member
save/load
im hopeing maybe in here i might finally get my answer for this.....but before i ask my question u need to know games that u can save where u r then load back to where u left off.....for explain Final Fansty 7 is a great explain.....and final fansty games save/load.....devil may cry 1-3.....ect.....now my question is how do i add a save/load to my game so it keeps all the date like....for explain name, how far u r, life, items, ur char, ect....
-
Apr 3rd, 2006, 03:12 PM
#2
Fanatic Member
Re: save/load
I would recommend storing everything in a text file. Write to it line by line or whatever when they save, then when they load, take that text file read it line by line and assign the data to the appropriate variables. This is very simple and allows you easy access to it, so you can edit the file yourself to put you indifferent areas of the game so you can test it.
Software languages known:
Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
Software API's known:
Directx 7 and 8
Internet languages, in the process of learning:
HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX
-
Apr 3rd, 2006, 03:16 PM
#3
Thread Starter
Addicted Member
Re: save/load
 Originally Posted by damasterjo
I would recommend storing everything in a text file. Write to it line by line or whatever when they save, then when they load, take that text file read it line by line and assign the data to the appropriate variables. This is very simple and allows you easy access to it, so you can edit the file yourself to put you indifferent areas of the game so you can test it.
1 problem.....i want to so other user not just me can save n load without trouple
-
Apr 4th, 2006, 08:06 AM
#4
Fanatic Member
Re: save/load
 Originally Posted by Ebiru
1 problem.....i want to so other user not just me can save n load without trouple
What do you mean? If you do damasterjo idea, it wont be any trouble to anyone. You just have a menu option to "save" that when they click it will write all the data you need to save into the text file. When the form loads, just read from this file and assign the values. I do it in the game I am working on now. The game autosaves and when the form loads, it reloads all the data from the file into the proper variables and starts you where you last were.
-
Apr 4th, 2006, 02:08 PM
#5
Addicted Member
Re: save/load
Depends what language you are using if you are using VB then you can use a user difined type then stick it straight into a binary file. Then realoding is simple. No parsing of text needed.
Rich
-
Apr 4th, 2006, 02:13 PM
#6
Thread Starter
Addicted Member
Re: save/load
 Originally Posted by Rich2189
Depends what language you are using if you are using VB then you can use a user difined type then stick it straight into a binary file. Then realoding is simple. No parsing of text needed.
Rich
can u explain to me how i can do this?
-
Apr 4th, 2006, 02:18 PM
#7
Addicted Member
Re: save/load
VB Code:
Private Type MyType
setting1 as integer
setting2 as string * 10
setting3 as byte
End Type
Dim settings As MyType
'save
Open "C:\settings.set" For Binary Access Write As #1
Put #1, , settings
Close #1
'load
Open "C:\settings.set" For Binary Access Read As #1
Get #1, , settings
Close #1
'access a setting
settings.setting1 = 1
Rich
-
Apr 4th, 2006, 03:58 PM
#8
Thread Starter
Addicted Member
Re: save/load
 Originally Posted by Rich2189
VB Code:
Private Type MyType
setting1 as integer
setting2 as string * 10
setting3 as byte
End Type
Dim settings As MyType
'save
Open "C:\settings.set" For Binary Access Write As #1
Put #1, , settings
Close #1
'load
Open "C:\settings.set" For Binary Access Read As #1
Get #1, , settings
Close #1
'access a setting
settings.setting1 = 1
Rich
1 it doesnt work 2 do i need to change anything n 3 how can i make it so when i click a button?
-
Apr 4th, 2006, 04:02 PM
#9
Addicted Member
Re: save/load
Well you have to stick the relavent code in the correct place,
this in the declarations
VB Code:
Private Type MyType
setting1 as integer
setting2 as string * 10
setting3 as byte
End Type
Dim settings As MyType
this in the save routine
VB Code:
Open "C:\settings.set" For Binary Access Write As #1
Put #1, , settings
Close #1
this in the load routine
VB Code:
Open "C:\settings.set" For Binary Access Read As #1
Get #1, , settings
Close #1
to get it to work with a button, stick it in a buttons onclick event. So if you want to have a load button, place a button on your form and put the load code into it.
Rich
-
Apr 4th, 2006, 04:07 PM
#10
Thread Starter
Addicted Member
Re: save/load
but how do i make it so that when i click load it will load me to the correct forum?
-
Apr 4th, 2006, 04:09 PM
#11
Addicted Member
-
Apr 4th, 2006, 04:31 PM
#12
Thread Starter
Addicted Member
Re: save/load
form....srry for misspelling
-
Apr 5th, 2006, 10:03 AM
#13
Member
Re: save/load
im no expert but..
private sub command1_click()
<code for loading>
end sub
I do this in my programs all the time..
private sub command1_click()
dim data as string
dim info as integer
dim fnum as freefile
open app.path & "\data.file" for input as #fnum
input #fnum,data
input #fnum,info
close #fnum
msgbox data + " "+info
etc etc etc
end sub
but of course you will need a command button and some info to read out of a file, you can test it by creating a file named data.file and putting :
test
1
into it
then run it..
-
Apr 5th, 2006, 12:21 PM
#14
Thread Starter
Addicted Member
Re: save/load
VB Code:
Private Type MyType
setting1 as integer
setting2 as string * 10
setting3 as byte
End Type
Dim settings As MyType
'save
Open "C:\settings.set" For Binary Access Write As #1
Put #1, , settings
Close #1
'load
Open "C:\settings.set" For Binary Access Read As #1
Get #1, , settings
Close #1
'access a setting
settings.setting1 = 1
that code is fine, its just i want it so when the file is loaded it will resume w/e it left off....(w/e mean what ever if u didnt know....)
-
Apr 19th, 2006, 12:52 PM
#15
Thread Starter
Addicted Member
Re: save/load
srry for double posting but i need help with this....
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
|