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.

Newcomers DBPro Corner / Saving Data

Author
Message
OldTifu
21
Years of Service
User Offline
Joined: 10th Jan 2003
Location: Scotland
Posted: 10th Jan 2003 18:47
Hallo, just got DarkBasic at New Years and so far, all is great I've started work on my first game which is going to be a remake of something I made in qbasic (so most of the logic is already in my head ) All's going fine so far, except I don't know how to save data...

Basically, I have an array tile(11,11) which will be used for the tiles that make up each room in the game. I have my level editor happily making these rooms, but I got no idea how to actually save them so I can use them... any help would be appreciated
jasuk70
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 10th Jan 2003 18:55
What i did for this sort of thing was: (this is from memory so code may need slightly modifying)



Then do the reverse (I.e OPEN TO READ and READ LONG)

Jas
OldTifu
21
Years of Service
User Offline
Joined: 10th Jan 2003
Location: Scotland
Posted: 10th Jan 2003 19:16
Ah! That works perfectly. Thanks
Now I have something to do all weekend...

Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 10th Jan 2003 19:24
more easy, with the arrays :
save array filename$,arrayname(0)
you can write too :

but if you write (0), it save all
it was the commande to save an array, and to load it ....... ....... load array
save array is more easy than open to write, but the two commands done the same thing

I'm following John, but I'm not john.
Lol, it is funnier in french
Arrow
21
Years of Service
User Offline
Joined: 1st Jan 2003
Location: United States
Posted: 10th Jan 2003 19:59
What about if you want to save stats like health and stuff?

This is Truth!
This is my Belief!
...at least for now.
rockabillypete
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 10th Jan 2003 20:01
whats a level editor please let me know is it sofware program. i must try arrays .

music is life
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 11th Jan 2003 00:55
Hito Hentai: then you put the stats like health and stuff into an array, and use the methods described above.

Rockabillypete: a level editor is a program which makes it easier to produce levels or environments for a game, by providing an easy interface. Usually people writing games will write their own level editor, tailored to their needs.
Abobo
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 12th Jan 2003 22:10
I just want to say, that you should use save arry. not open write. once you compile the file you can't just open and read your info! this realy scrood me up once so don't make the same mistake.
Shadow
22
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 13th Jan 2003 17:50
Abobo: "I just want to say, that you should use save arry. not open write. once you compile the file you can't just open and read your info! this realy scrood me up once so don't make the same mistake."

Is this because the file is made part of your .exe?

If so, could you somehow keep the file separate?
Abobo
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 14th Jan 2003 00:58
Yes, it's becase it was part of the exe file.
you can avoid this by making it a file name like "something.something" if it's a reconized file type DB will include it in the exe. and if you try to read numbers from it, it will be all messed up. if you use the "save array" and "load array" commands you will not run into this.
OldTifu
21
Years of Service
User Offline
Joined: 10th Jan 2003
Location: Scotland
Posted: 14th Jan 2003 02:04
Well, i'll do it that way then, less code too ^_^

Login to post a reply

Server time is: 2024-11-23 21:21:06
Your offset time is: 2024-11-23 21:21:06