Easy way to saving HIGH SCORE!!! (source code, chek it out)
Author |
Message |
xHoly-Divinity
|
Posted: Thu Jan 20, 2005 8:27 pm Post subject: Easy way to saving HIGH SCORE!!! (source code, chek it out) |
|
|
I've done some experimenting, and have finally figured out an efficient, non confusing way to save high score (or any other info). You must create a text document in the folder of where your program is located called Highscore.txt. When you create it, type in any number value just so that it has a value (you should type in 0 because technically the high score at this time is 0), then save the .txt file. Here's the code!
code: |
var check : array 1 .. 1 of int
%Assigns pathName to 'Highscore.txt'
const pathName : string := "Highscore.txt"
var f : int
%Opens the file to check the old high score
open : f, pathName, get
get : f, check (1)
%Closes the text file
close : f
%Checks to see if the new score is higher than the old score
if score > check (1) then
%If it is, it will open the file and save the new high score
open : f, pathName, put
put : f, score
close : f
end if
%This procedure (same as above) opens 'Highscore.txt'
var one : int
var sss : array 1 .. 1 of int
open : one, "Highscore.txt", get
get : one, sss (1)
put " HIGH SCORE: ", sss (1)
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Andy
|
Posted: Thu Jan 20, 2005 8:29 pm Post subject: (No subject) |
|
|
this belongs to source code, moved |
|
|
|
|
|
Cervantes
|
Posted: Thu Jan 20, 2005 8:31 pm Post subject: (No subject) |
|
|
psst |
|
|
|
|
|
xHoly-Divinity
|
Posted: Thu Jan 20, 2005 8:34 pm Post subject: (No subject) |
|
|
Cerevantes, that source code is 10x longer, and 10x harder to understand |
|
|
|
|
|
Andy
|
Posted: Thu Jan 20, 2005 8:42 pm Post subject: (No subject) |
|
|
yea and about 100 times better... at least read his code.. it contains alot more than just adding high scores |
|
|
|
|
|
xHoly-Divinity
|
Posted: Thu Jan 20, 2005 8:46 pm Post subject: (No subject) |
|
|
That's why everyone is complaining that it doesn't work and that they don't understand it |
|
|
|
|
|
Andy
|
Posted: Thu Jan 20, 2005 8:51 pm Post subject: (No subject) |
|
|
i have a question for you, have u even ran the code? the ppl who posted there didnt have a clue waht the program was for, would u like me to abuse your code then tell you it doesnt work? of course not, so take his code, run it, and then see how it works, why it works, then past judgement on his works |
|
|
|
|
|
Shyfire
|
Posted: Fri Jan 21, 2005 2:27 pm Post subject: (No subject) |
|
|
both u 2 stop fighting both codes work who cares whos is better |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Andy
|
Posted: Fri Jan 21, 2005 3:54 pm Post subject: (No subject) |
|
|
im guessing you never ran his code either |
|
|
|
|
|
[Gandalf]
|
Posted: Fri Jan 21, 2005 4:27 pm Post subject: (No subject) |
|
|
Quote: i have a question for you, have u even ran the code? the ppl who posted there didnt have a clue waht the program was for, would u like me to abuse your code then tell you it doesnt work? of course not, so take his code, run it, and then see how it works, why it works, then past judgement on his works
I take that to offence
naw, im OK, but I did get a high score system to work - the only problem : it doesn't have a "sorting" system. Which I see that this code doesn't have - and also could include more than one score. Anyway, they're both good in different ways, simplicity and wholeness - nobody should be attacked for trying to help out (I think lol). |
|
|
|
|
|
zomg
|
Posted: Fri Jan 21, 2005 6:04 pm Post subject: (No subject) |
|
|
[Gandalf] wrote: nobody should be attacked for trying to help out (I think lol).
i agree... unless the person isnt helping out in anyway. but this one here helps newb programmers to learn just the basic I/O which is good because it doesnt get all complex. because when things start get complex ppl just tend to leave it, especially if there noobs |
|
|
|
|
|
MiX-MaztA-M8riX
|
Posted: Tue Jan 25, 2005 11:56 am Post subject: (No subject) |
|
|
Quote: ... because when things start get complex ppl just tend to leave it, especially if there noobs ...
Maybe thats why half the 'N00bz0r5' or w/e you ppl call it these days, havent even ran the code |
|
|
|
|
|
|
|