incrementing in float script controler

I need evaluate simple expression var+=distance p1 p2
so I:
Added a Custom Attribute to the Scripted Controller's track.
Assigned a Bezier Float controller to the Parameter in the Custom Attribute
Created a variable called var in the Scripted Controller
*Assigned the Controller of the CA Parameter to the variable
*In the Scripted Controller, entered var+=distance p1 p2 (where p1,p2 are nodes)

result: no incrementation. I`m struggling with this whole day, is there any way to do such basic operation. I need this as float controller, can any body know the magic trick?