player1|39
...
player22|552
...
To insert the new player's score and name, I wanted to use this:
Code: Select all
*Mem = AllocateMemory (5000)
*Mem2 = AllocateMemory (5000)
Protected Lines.w
Protected Size.w
Protected ActualSize.w
Protected String.s
Protected PlayerScore.w
OpenFile (1,"Highscore.ini")
ReadData (1,*Mem,Lof(1))
Lines = CountString (PeekS (*Mem),"|")
FreeMemory (*Mem)
For i = 0 To Lines
Size = ReadData (1,*Mem2,200)
ActualSize + Size
String = PeekS (*Mem2)
PlayerScore = Val(StringField(String,2,"|"))
If PlayerScore > X
FileSeek (1,ActualSize)
WriteStringN (1,Name + "|" + Str(X))
EndIf
Next
FreeMemory (*Mem2)
CloseFile (1)
Thanks in advance
P.s. I didn't use integers because I have to use my old computer right now; it only has PB 4.00 (and some kinda weird version of that!)



