BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"Simple Hi Score Function"
, by benny
This is a simple function I created to create and save hi score data.
Code
;---------------------------------------------------------------; ; Code library function Created By Ben Kiemle ; ; Function for: hi score system ; ; Last Updated: November 7, 2003 ; ; ; ; -How to implement- copy function into game. Call using the ; ; hiScore() function. Function determines whether the current ; ; score is greater then the previous hiscore (which should be ; ; found in a file name hiscore.txt. You can substitute ; ;hiscore.txt For whatever file you keep your hiscore in). If it ; ;is, it saves the hi score. ; ; ; ; Variables needed to be set as Global are: score% (You do not ; ; have to use score as your variable. Substitute score for ; ; whatever variable you use to keep track of the players score) ; ;---------------------------------------------------------------; Function hiScore() hiScore=OpenFile("hiscore.txt");opens the current hi score file Read1%=ReadLine(hiScore) CloseFile(hiScore) If score > Read1% newHiScore=WriteFile("hiscore.txt");creates a new hi score file to be written to WriteLine(newHiScore,score);writes the new hi score to the file CloseFile(newHiScore) EndIf End Function
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations