PDA

View Full Version : Another one from me!


Mike Halliday
11-02-2007, 12:07 AM
Here is a highscore routine

Read from file, write to file and display on screen!

Highscores.dat contains 10 scores and names

3 extra funcs/procs

readHIGHSCORES() - loads the file in to global array, returning FALSE if the file is not found.

sortHIGHSCORES() - bubble sorts high to low and dumps the lowest from the list

writeHIGHSCORES() - updates the highscores.dat file

If the highscores.dat file is missing you are warned that saves are unavailable and temp score are created.

Hope its useful! - See how it works in the example code.

[Mike][br]1193958437_671_FT0_highscores.zip

Slither
11-02-2007, 12:32 AM
Thats a good contribution Mike! Thankyou! Once I have something I will chuck it up there.

Regards,

Slither2006.

Donone
11-02-2007, 07:12 AM
Hello Mike. Great and very very useful. Will save a lot of time for everybody needing it.
BTW a small problem with the array size line 62, you either need 10 as your max or simply set Dim(Name$,12) & Dim(score$,12) and it's fine (remember zero based).

I like the fading into obscurity! :-)

Mike Halliday
11-02-2007, 08:15 AM
Glad you all like it so far.

I tried with 10 as the Array Max and was hitting an Access Violation so I upped it - I think this was because I was not closing down fully and there was some variable leak

Could be another vista issue - needs more investigation.

Donone
11-02-2007, 09:53 AM
Setting Dims to 12 worked fine for me. Prior to that I got the access violation.
Keep it coming

kornalius
11-02-2007, 12:02 PM
Thank you very much Mike for the contribution and the time you spend helping others, this is very appreciated.

So much new content for the newsletters! ;)

Mike Halliday
11-02-2007, 12:04 PM
Element 11 of the array stores the current score and I the code looks for A$+1 so when A$ reaches 10 .. 11 should work, but it doesn't unless you include an extra space in the array!!! - most strange.