Hi scores shuffle

Blitz3D Forums/Blitz3D Beginners Area/Hi scores shuffle

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I have a high score table in my game. However, when I try to insert a score into the table, although it appears in correct place, and the scores above are right, any that follow are not right can anyone see where I have gone wrong?



position=0

For f=10 To 1 Step-1

number=(hiscoredata$(f,2))

If score>number

	position=f
	
EndIf

Next


If position>0
	For f=(position) To 9
	
		hiscoredata$(f,1)=hiscoredata$(f+1,1)
		hiscoredata$(f,2)=hiscoredata$(f+1,2)
		
	Next
	
	hiscoredata$(position,1)=name$
	hiscoredata$(position,2)=score
	
ffile=WriteFile("HSTable.SCO")
	For f=1 To 10
	WriteLine ffile,hiscoredata$(f,1)
	WriteLine ffile,hiscoredata$(f,2)
	Next
		
	
EndIf













I know it's to do with this section:

If position>0
	For f=(position) To 9
	
		hiscoredata$(f,1)=hiscoredata$(f+1,1)
		hiscoredata$(f,2)=hiscoredata$(f+1,2)
		
	Next
	
	hiscoredata$(position,1)=name$
	hiscoredata$(position,2)=score


but I can't see how to correct it - (I gess it's the heat :) )