I’m not sure if I understand you correctly, but in a set-up like this:

the Value goes 0, 1, 2, … when you move the Cube to the right.
If you use the arrow in stead of the cube, constrain it’s X-location between 0 and 9 and lock it’s Y- and Z- location, that will give you the behaviour that (I think) you want…
In case you can’t read it, the scripted expression I used is. ‘var-var%1’. and var is the X-location of the Cube.