Saving settings/scores

BlitzMax Forums/BlitzMax Beginners Area/Saving settings/scores

Here's a simple example of saving 10 random scores in a way that can't be edited with notepad... just the scores though, not names (im a beginner too :P). There might be better ways, i dunno...

Graphics 320,240,0

Global score[10]


''''' create score file w/ random scores

file=WriteFile("scores.dat")

For r=0 To 9
	WriteInt file,Rand(9999999)
Next

CloseStream file


''''' load score file
file=ReadFile("scores.dat")

For r=0 To 9
	score[r]=ReadInt(file)
Next

CloseStream file

''''' display scores

While Not KeyHit(KEY_ESCAPE)
	Cls

	For r=0 To 9
		DrawText score[r],130,(r*20)+20
	Next
			
	Flip
Wend


check out the scores.dat file it creates in notepad..