Hi,

the local var 'idist' gets not initialized. You should initialize it with a very high value prior to the while loop (eg var idist = 999999;).
Otherwise the condition of 'if(vec_dist(my.x,you.x) < idist)' can't be fulfilled at the beginning. I think that's the problem.