I need help for writing a highscores function. I don't understand why it won't work. so far here's what it looks like
;pn1 and pn2 are player 1's socre and player 2's score
;time4# is time used in secs
;time5 is time used in mins ex: time5+":"+time4#
;lock1 is the number of human players
Function record(pn1,pn2,time4#,time5,lock1)
sett = OpenFile("settings.data")
If lock1 = 1 Then ; check if its a one player game
If pn1 > pn2 Then ; check if player 1 won
ReadLine(sett)
ReadLine(sett)
ReadLine(sett)
ReadLine(sett);move the cursor to the right position
ReadLine(sett);name
pn3t5=ReadLine(sett);mins
pn3t4#=ReadLine(sett);secs
ReadLine(sett);level
If time5 = pn3t5 Then; check if you beat the last highscore
Else
If time5 > pn3t5 Then Goto highscored
If time4# > pn3t4# Then
.highscored
SeekFile(sett,0);start back at first line
ReadLine(sett)
ReadLine(sett)
ReadLine(sett)
ReadLine(sett) ; this brings the cursor to the right spot
Print "congrats you made the highscores enter your name! "
name$=Input$("")
Trim$(name$)
Print"writing data..."
WriteLine(sett,name$)
WriteLine(sett,time5)
WriteLine(sett,time4#)
WriteLine(sett,level)
Print"data written!"
EndIf
EndIf
EndIf
EndIf
CloseFile(sett)
End Function
;pn1 and pn2 are player 1's socre and player 2's score
;time4# is time used in secs
;time5 is time used in mins ex: time5+":"+time4#
;lock1 is the number of human players
Function record(pn1,pn2,time4#,time5,lock1)
sett = OpenFile("settings.data")
If lock1 = 1 Then ; check if its a one player game
If pn1 > pn2 Then ; check if player 1 won
ReadLine(sett)
ReadLine(sett)
ReadLine(sett)
ReadLine(sett);move the cursor to the right position
ReadLine(sett);name
pn3t5=ReadLine(sett);mins
pn3t4#=ReadLine(sett);secs
ReadLine(sett);level
If time5 = pn3t5 Then; check if you beat the last highscore
Else
If time5 > pn3t5 Then Goto highscored
If time4# > pn3t4# Then
.highscored
SeekFile(sett,0);start back at first line
ReadLine(sett)
ReadLine(sett)
ReadLine(sett)
ReadLine(sett) ; this brings the cursor to the right spot
Print "congrats you made the highscores enter your name! "
name$=Input$("")
Trim$(name$)
Print"writing data..."
WriteLine(sett,name$)
WriteLine(sett,time5)
WriteLine(sett,time4#)
WriteLine(sett,level)
Print"data written!"
EndIf
EndIf
EndIf
EndIf
CloseFile(sett)
End Function