this is done by having the auto turrent check the list of distances and ckecks one by one if the current distance is smaller that the last distance. (also clone x and y are here for other things that you might need). also be wary you can delete the [ask] blocks.