Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Highscores???
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tony_200004




PostPosted: Sat Jan 17, 2004 11:08 pm   Post subject: 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...

code:

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...
Quote:

Assert must be boolean type

and savefile is highlighted
thanks for any help you can provide... Shocked
Sponsor
Sponsor
Sponsor
sponsor
Tony_200004




PostPosted: Sat Jan 17, 2004 11:13 pm   Post subject: (No subject)

NVM read one of the topics and found it.. thanks for any attempts though at helping
Tony_200004




PostPosted: Sat Jan 17, 2004 11:18 pm   Post subject: (No subject)

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 or Very Mad [/code]
Dan




PostPosted: Sat Jan 17, 2004 11:27 pm   Post subject: (No subject)

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
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Tony_200004




PostPosted: Sat Jan 17, 2004 11:33 pm   Post subject: (No subject)

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




PostPosted: Sat Jan 17, 2004 11:35 pm   Post subject: (No subject)

when you type:

code:

open : datafile, "topscore.txt", put


it empties the file, and basically starts a new.. so what you need to do is:

code:

open : datafile, "topscore.txt", get


then read everything in the file.. and then reput it..
Tony_200004




PostPosted: Sun Jan 18, 2004 8:13 am   Post subject: (No subject)

i changed the puts to get's and there now are a bunch of errors lol
code:

        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...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: