Ok, I used my functions to create a highscore list. Here's the code:
rem Create Default HSL and Then Load It Into Your Program
File$="HSL.txt" : MaxHSL=3
GoSub Create_HSL : GoSub Load_HSL
rem Ask for the player's score
Input "Score: ",Score
rem Check Player's Score For Their Position In The HSL
GoSub Check_SP
rem Save HSL
GoSub Save_HSL
rem End Program
End
Create_HSL:
Create_File(File$,MaxHSL) : Score=300
For Num= 1 To MaxHSL
Write_String(File$,Num,Str$(Score)) : Dec Score,100
Next Num
Return
Load_HSL:
Dim HSL$(MaxHSL)
For Num= 1 To MaxHSL : HSL$(Num)=Read_String(File$,Num)
Next Num
Save_HSL:
For Num= 1 To MaxHSL : Write_String(File$,Num,HSL$(Num)) : Next Num
Return
Check_SP:
If Score>Val(HSL$(3)) and Score<Val(HSL$(2)) Then HSL$(3)=Str$(Score)
If Score>Val(HSL$(2)) and Score<Val(HSL$(1))
HSL$(3)=HSL$(2) : HSL$(2)=Str$(Score)
EndIf
If Score>Val(HSL$(1))
HSL$(3)=HSL$(2) : HSL$(2)=HSL$(1) : HSL$(1)=Str$(Score)
EndIf
Return
Function Create_File(FileName$,MaxLines)
If File Open(31)=1 Then Close File 31
If File Exist(FileName$)=1 Then Delete File FileName$
Open To Write 31,FileName$
Write String 31,"Lines:"+Str$(MaxLines)
For LineNum= 1 To MaxLines
Write String 31,"Line#:"+Str$(LineNum)
Next LineNum
Close File 31
EndFunction
Function Write_String(FileName$,LineNum,Data$)
If File Open(31)=1 Then Close File 31
If File Open(32)=1 Then Close File 32
If File Exist("TempFile.dat")=1 Then Delete File "TempFile.dat"
Copy File FileName$,"TempFile.dat"
Delete File FileName$
Open To Read 31,"TempFile.dat"
Open To Write 32,FileName$
Read String 31,MaxLines$
Write String 32,MaxLines$
For CurrentLine= 1 To (LineNum-1)
Read String 31,OldData$
Write String 32,OldData$
Next CurrentLine
Write String 32,"Line#:"+Str$(LineNum)+" "+Data$
For CurrentLine= (LineNum+1) To Val(MaxLines$)
Read String 31,OldData$
Write String 32,OldData$
Next CurrentLine
Close File 31
Close File 32
Delete File "TempFile.dat"
EndFunction
Function Read_String(FileName$,LineNum)
If File Open(31)=1 Then Close File 31
Open To Read 31,FileName$
Read String 31,Data$
For CurrentLine= 1 To LineNum
Read String 31,Data$
Next CurrentLine
Close File 31
DataInfo=Len(Data$)
DataInfo=DataInfo-11
DataInfo=DataInfo-Len(Str$(LineNum))
Data$=Right$(Data$,DataInfo)
EndFunction Data$
Just run it and it will ask you for your score, when you actually use it for something you won't want it to ask you, but be whatever score the player got. Then close out of the program and then run this code to check the highscore list:
Dim HSL$(3)
For Num= 1 To 3
HSL$(Num)=Read_String("HSL.txt",Num)
Print HSL$(Num)
Next Num
End
Function Read_String(FileName$,LineNum)
If File Open(31)=1 Then Close File 31
Open To Read 31,FileName$
Read String 31,Data$
For CurrentLine= 1 To LineNum
Read String 31,Data$
Next CurrentLine
Close File 31
DataInfo=Len(Data$)
DataInfo=DataInfo-11
DataInfo=DataInfo-Len(Str$(LineNum))
Data$=Right$(Data$,DataInfo)
EndFunction Data$
I made it so it does a highscore list of only three scores, but I'll make when where you can have any size list you want, I'll do that tonight. Let me know how it works

.