Why doesnt this work...right?

Blitz3D Forums/Blitz3D Beginners Area/Why doesnt this work...right?

working on my lil game gui for the options menu, i need sliders (Blitz3D) and i came up with this.... I left out the mouuse state bit cuz thats another set of functions ....
Type SLIDER
	Field ID% ; ID
	Field XP% ; X Pos
	Field YP% ; Y Pos
	Field MX% ; Max Value
	Field MN% ; Min Value
	Field CV% ; Curr. Value
	Field ST% ; State (Mouse Up/Over/Dwn etc...)
	Field DR% ; Direction (Vertical / Horizontal)
	; Field EN% ; ImageEntity
End Type

Graphics3D 300,300,32,2
SetBuffer BackBuffer()

SliderCreate(0,52,80,0,100,50,0,0)
SliderCreate(0,80,150,0,100,50,0,1)

While Not KeyHit(1)
	Cls
	
	SliderUpdate%()
	
	RenderWorld
	UpdateWorld
	Flip
Wend

End


Function SliderCreate(ID%=-1,XP%=0,YP%=0,MN%=0,MX%=100,CV%=50,ST%=0,DR%=0)
	S.SLIDER = New SLIDER
	S\ID%    = ID%
	S\XP%    = XP%
	S\YP%    = YP%
	S\MN%    = MN%
	S\MX%    = MX%
	S\CV%    = CV%
	S\ST%    = ST%
	S\DR%    = DR%
	; S\EN%    = EN%
	SliderDraw(S\ID%)
	Return True
End Function

Function SliderUpdate%()
	For S.SLIDER = Each SLIDER
		If S\DR%=0
			If MouseX() > S\XP% And MouseX() < S\XP% + S\MX% And MouseY() > S\YP% And MouseY() < S\YP% + 22 And MouseDown(1)=1
				S\CV% = S\CV%+MouseXSpeed();(S\MX%/100*)
				If S\CV%>=S\MX% Then S\CV%=S\MX%
				If S\CV%<=S\MN% Then S\CV%=S\MN%
			EndIf
		ElseIf S\DR%=1
			If MouseX() > S\XP% And MouseX() < S\XP% + 22 And MouseY() > S\YP% And MouseY() < S\YP% + S\MX% And MouseDown(1)=1
				S\CV% = S\CV%+MouseYSpeed();(S\MX%/100*)
				If S\CV%>=S\MX% Then S\CV%=S\MX%
				If S\CV%<=S\MN% Then S\CV%=S\MN%
			EndIf
		EndIf
		Text 20,20,S\CV%
		SliderDraw(S\ID%)
	Next
	Return True
End Function

Function SliderDraw(ID%)
	For S.SLIDER = Each SLIDER 
		If S\ID% = ID% Then 
			If S\DR% = 0 Then 	
				Color 255,255,255
				Rect S\XP%-11,S\YP%,S\MX+22,21
				Color 122,122,122
				Rect S\XP%+(S\MX%/100*S\CV%)-11,S\YP%+1,22,19
			ElseIf S\DR% = 1 Then
				Color 255,255,255 
				Rect S\XP%-11,S\YP%-11,22,S\MX%+22
				Color 122,122,122
				Rect S\XP%-11+1,S\YP%+(S\MX%/100*S\CV%)-11,20,19
			EndIf
		EndIf
	Next
	Return True
End Function


now both horizontal and vertical work ... kina but they are still flawed.... can anyone help improve this? it would seem that when initialized the gadget auto jumps to 100 witch should not be, also when moving to fast with the mouse the slider looses focus.... :(


NOT BLITZ PLUS! BLITZ3D....