Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Saving in a game

Author
Message
Slayer93
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: I wish I knew
Posted: 12th Aug 2004 01:09
Can someone help make me a save program where you can save or is that not possible.
Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 12th Aug 2004 01:21
So you want to make a game where you can save your position, your status, and so on ?

In your place I would use commands like OPEN TO WRITE 1, "save.hgt"

- Mind the gap -
Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 12th Aug 2004 01:21
It's possible, all you have to do is write all the data you need saved to a file, then read that data later.

[center]
Rush owns--> www.Rush.com ---> I'm going to see them Aug. 7
Come to #coding. We promise we wont kick you!
Lzdude69
21
Years of Service
User Offline
Joined: 21st May 2004
Location: Indiana
Posted: 12th Aug 2004 09:21
yeah, like this.


rem save function
if savegame()=1
open to write 1,"savegame.dat"
for t=1 to 1
write string 1,object position x()
next t
for t=2 to 2
write string 1,object position y()
next t
for t=3 to 3
write string 1,object position z()
next t
for t=4 to 4
rem what ever your game stats are
next t
endif


Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 12th Aug 2004 11:13
Alienman, you dont need to have a "FOR NEXT" loop every time you write your data. You could just use one big loop, or use seperate WRITE commands.

[center]
Rush owns--> www.Rush.com ---> I'm going to see them Aug. 7
Come to #coding. We promise we wont kick you!
Lzdude69
21
Years of Service
User Offline
Joined: 21st May 2004
Location: Indiana
Posted: 12th Aug 2004 11:17
I do it that way so you can control which line you write the data, like

for t=5 to 5
open to write 1,object position x()
next t

will write the object position on line 5 of the file. If it doesnt matter then just do one big loop, and it will write them in order. Like if it mattered which line the data was on.


Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 12th Aug 2004 11:19
That doesnt determine which line it gets written to. It its always written one line at a time. The order you write is the order you read.

[center]
Rush owns--> www.Rush.com ---> I'm going to see them Aug. 7
Come to #coding. We promise we wont kick you!
Slayer93
20
Years of Service
User Offline
Joined: 5th Aug 2004
Location: I wish I knew
Posted: 13th Aug 2004 04:15
Thank's for the help !!

Login to post a reply

Server time is: 2025-05-25 09:59:03
Your offset time is: 2025-05-25 09:59:03