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.

Author
Message
Chinless Miracle
14
Years of Service
User Offline
Joined: 16th Feb 2012
Location:
Posted: 23rd Mar 2012 13:24
Hi cannot seem to get my high score table working, saving to an external file doesnt see to be workign. Please help


high score table


full game


Thanks, and goodnight.
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 23rd Mar 2012 19:26
In what way is it not working? Is the data wrong? Is the file not being created? Is it being created but empty?

The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 23rd Mar 2012 19:49
I haven't tried your code but a cursory glance at it brings my attention to...

delete file "High Scores.txt"
close file 1

...trying to delete a file while it's still open by the system is bad practice.
Alien002
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 24th Mar 2012 00:07
you should not be useing 3 do loop. There should be only 1 do loop. there are sync all over the place.

goto command must be never be used.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 24th Mar 2012 01:31
hmm, try while>endwhile and or gosub>return maybe?

Chinless Miracle
14
Years of Service
User Offline
Joined: 16th Feb 2012
Location:
Posted: 24th Mar 2012 13:17
The table works fine when i'm using the program for the first time but when i start a new game and go to the high score table its only displaying the name. When i exit the game i check the high scores file and the name and score are saved there so i think its a problem with reading in the score

Thanks, and goodnight.
The Weeping Corpse
14
Years of Service
User Offline
Joined: 19th Sep 2011
Location: United Kingdom
Posted: 24th Mar 2012 20:45
This is an extract from an online dbpro help file.
http://dbprohelp.wikia.com/wiki/OPEN_TO_WRITE

Quote: "This command will open a file, ready for writing.
Syntax

OPEN TO WRITE File Number, Filename

bla bla bla bla bla bla

The file must not exist or the command will fail. You can open up to 32 files at the same time, using a file number range of 1 through to 32. "


ok, now this is a snipit of your high score table code

Quote: "delete file "High Scores.txt"
close file 1
open to write 2,"High Scores.txt"
"


so to my mind, delete file will fail because the file in question is already open. Windows won't allow you to delete a file while its handle is in use (by either DB or the windows file cache). This also means that the open to write command will also fail (because the file already exists as per the help file).

close file 1
delete file "High Scores.txt"
open to write 2,"High Scores.txt"

is the correct command sequence.
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 24th Mar 2012 21:53 Edited at: 24th Mar 2012 21:54
What Weeping said sounds correct, but also ...

Quote: "so i think its a problem with reading in the score"


It's so much easier to help with a clearer explanation of the problem! You're not reading the data in and converting it properly.



You want to read your string, convert it to an value and then put it into 'score(reading', so you need:




Login to post a reply

Server time is: 2026-07-10 15:52:05
Your offset time is: 2026-07-10 15:52:05