
-----------------------------------
Tony_200004
Sat Jan 17, 2004 11:08 pm

Highscores???
-----------------------------------
Hey... a guy that was in my CS class learned how to do highscores.... now i wont be able to see him for a long time so i need you guys to help me with it... basicly this is what he had...


var savefile:int
var money :int
var name :string
%where the game quit it does this
open : savefile, "topscore.txt",put
assert savefile, money, " ",name
close : savefile

i changed the code as it would be in my game and it didnt work kept giving me this...

Assert must be boolean type

and savefile is highlighted
thanks for any help you can provide...  :shock:

-----------------------------------
Tony_200004
Sat Jan 17, 2004 11:13 pm


-----------------------------------
NVM read one of the topics and found it.. thanks for any attempts though at helping

-----------------------------------
Tony_200004
Sat Jan 17, 2004 11:18 pm


-----------------------------------
ok lol... i got the highscores and all but got one more problem..
[code]
        var datafile : int
        open : datafile, "topscore.txt", put
        put : datafile, name, " with, $", money
        close : datafile
[code]
this is what it looks like... now the problem is, the thingy saves over any previous score... there is only one score in the txt at a time... please help me lol...  :evil: [/code]

-----------------------------------
Dan
Sat Jan 17, 2004 11:27 pm


-----------------------------------
well the easy way to do it whould be to 1st read the hole high score file in to an array then sort it by sorce and check if the new one is high enogth to be put in.

once that is done put the HOLE array back in the file so it dose not just wirte one score but all of them that were in the file as well

-----------------------------------
Tony_200004
Sat Jan 17, 2004 11:33 pm


-----------------------------------
lol sorry im kinda confused here... can you just give me like some example code or something so i know what im doing? thanks

-----------------------------------
santabruzer
Sat Jan 17, 2004 11:35 pm


-----------------------------------
when you type:


open : datafile, "topscore.txt", put 


it empties the file, and basically starts a new.. so what you need to do is:


open : datafile, "topscore.txt", get


then read everything in the file.. and then reput it..

-----------------------------------
Tony_200004
Sun Jan 18, 2004 8:13 am


-----------------------------------
i changed the puts to get's and there now are a bunch of errors lol

        open : datafile, "topscore.txt", put
        put : datafile, name, " with, $", money
        close : datafile

can you please just fill it in how it should be because im getting lots of errors...
