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 / File creating/writing/reading help

Author
Message
EvilKnuckles 666
21
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 9th Mar 2004 22:46
In my game, i'm making a high score feature but i'm not familiar w/ the file commands. could someone give me and idea or basic structure of what it should be like.
Here's what i want to be in the file:

"high1" "difficutly" Time
"high2" "difficutly" Time
"high3" "difficutly" Time
"high4" "difficutly" Time
"high5" "difficutly" Time
EvilKnuckles 666
21
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 10th Mar 2004 22:10
can ANYONE help? or know somewhere for me to look that i can get help from?
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 10th Mar 2004 22:21
Thats kinda easy, here's the idea:

You write 5 highscores(strings) then 5 difficulties(strings) then 5 time's(float/string)


Do this in your program
-Check if the file exists
-If it exists do:
open to read 1,"highscores.dat
for a=1 to 5
read string 1,high_score$(a)
read string 1,high_diffi$(a)
read float 1,high_time#(a)
next a
close file 1


-When the user is playing, then update the high scores arrays


-At the end do this:
if file exist("highscores.dat")=1 then delete file "highscores.dat"
open to write 1,"highscores.dat"
for a=1 to 5
write string 1,high_score$(a)
write string 1,high_diffi$(a)
write float 1,high_time#(a)
next a
close file 1


im not sure if the syntax is correct, but its a basic idea

Quote: "
UPDATED

Amd 2800+ | 1024mb pc3200 | A7N8eluxe | Ati Radeon 9800PRO 256mb
"
EvilKnuckles 666
21
Years of Service
User Offline
Joined: 23rd Jun 2003
Location:
Posted: 10th Mar 2004 23:39
awesome, thanks

Login to post a reply

Server time is: 2024-09-22 00:40:29
Your offset time is: 2024-09-22 00:40:29