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 / Directories, Files and Saving oh my!

Author
Message
Black Hydra
20
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 19th Oct 2003 02:01
I have been working on a 3-D space invaders game for a couple days now and the game is down solid. I wanted to add a high scores table however, and that would require saving data into files I believe. I already have scoring it just isn't saved.

I looked through the file commands and I am afraid my general computer knowlage just isn't up to snuff. I feel stupid (probably am) for asking this but what exactly do I do to save the name and score of players in a text folder.

I am not sure how to go about it. I know it would involve read and write commands but with directories, files and the likes I am stumped. If someone could get me over this roadblock I could finish my first game.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 19th Oct 2003 02:15 Edited at: 19th Oct 2003 02:18
I find that the easiest way to save stuff like that is to have it in an array first (it probably already is).

Something like this:

HiScore(10)
and
HiScoreName$(10)

Then all you have to do is:

SAVE ARRAY {filename},HiScore(0)
SAVE ARRAY {filename},HiScoreName$(0)


Then to load them back in use:

LOAD ARRAY {filename},HiScore(0)
LOAD ARRAY {filename},HiScoreName$(0)


Note the use of Zero in the array dimension. Always use zero regardless of the size of your array.

Hope that helps
Black Hydra
20
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 19th Oct 2003 04:07
Thanks, Scraggle! I will try that out.

Login to post a reply

Server time is: 2024-09-21 06:37:43
Your offset time is: 2024-09-21 06:37:43