The reason you are running into this is because the 'untilEncoderCounts' command automatically resets the encoder counts when it is called (pulled from the NatLang_Cortex.c include file):
This particular task may be beyond the functionality of the Natural Language programming and could serve as a good introduction to true ROBOTC programming. You can create either a custom function without the 'SensorValue[sensorPort] = 0;' command (or equivalent), or add the while loop directly into the code:
There are also other ways to perform this behavior and these are only two examples of how to do this.
Check out our Blog
! And our Facebook page
Need help? Take a look at our updated help documentation
and the ROBOTC Forums.