Slider-spinner control problem

Hello,

I wrote a simple script to control a foot rig, but there is a tipycal problem with the sliders... It's the next:

I create an event to make changes on the foot. (on Slider changed val do etc.) These happenings are simple step animations. There are 'borders'/'limits', wich help to set unique poses on the bones. When the slider is in the 0.0-0.5 limit, the pose of bones is: blabla, when the slider's value is in the 0.5-0.75 limit the bones are in the blabla position, etc...

It works fine, when I change the value of slider manually! Otherwise, I want to it animate. When I set the slider's value be 0 at the first frame, and be 1.0 at the 50. frame, the event is not works! So the script skip the change of variables, and skip all of the functionst because the event works only when I change manually the slider.

The big question: What can I use to solve this event problem? Wich kind of events run when something changes the value of slider, for example a key animation, or an other spinner-slider etc...?

A part of the script:

on lepes_Sl changed val do
(
	border = #(0, 0.5, 0.75, 1.0)
	p = 
		#(
			#(0.0,-18.0,-32.9,0.0,-15.7,-19.8,-23.8,0.0,-13.6,-21.3,-10.2,0.0,0.0,0.0,-12.5,-13.9,-15.6,0.0,0.0,0.0,-7.1,-12.5),
			#(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0),
			#(3.8,41.1,14.3,0.4,32.3,38.1,0.7,-6.7,38.7,22.0,11.5,-1.2,0.0,6.2,21.2,19.1,28.5,-4.7,0.0,-10.0,16.4,20.9),
			#(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0),
		)
 
	local x=1
	while (val > border[x]) do 
		x = x+1
	------------
 
	ca = getCaAttributes_fn()
	if ca.count > 0 do
	(
		for i = 1 to ca.count do
		(
			--print p[x-1][i] + (val - border[x-1]) / (border[x] - border[x-1]) * (p[x][i] - p[x-1][i])
			try(ca[i].value = p[x-1][i] + (val - border[x-1]) / (border[x] - border[x-1]) * (p[x][i] - p[x-1][i]))catch()
		)
	)			
)

Thanks your answers in advance.

Matyrix