Ok, I'm getting close ... I moved the while() loop down the code a bit ... now the objects are moving a little better ... but go off in random directions rather than making there way to were I right click ... new code ..... any suggestions ....

function moveObject()
{

mouse_mode = 4;
mouse_range = 10000;
//mouse_map = IM_MOUSE;
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;

Temp1.x = selected.x;
Temp1.y = selected.y;
Temp1.z = 50;

vec_for_screen(Temp1,camera);

Temp2.x = mouse_pos.x;
Temp2.y = mouse_pos.y;
Temp2.z = 5000;

vec_for_screen(Temp2,camera);

c_trace(Temp1,Temp2,IGNORE_PASSABLE | IGNORE_YOU);
target.z += 30;
vec_set(selected.Target_X,target.x);
while(1){
if(vec_dist(selected.x,selected.Target_X) > 14)
{
selected.skill1 = 5*time_step;
}

vec_diff(Temp,selected.Target_X,selected.x);
Temp.y = 0;
vec_to_angle(selected.pan,Temp);

c_move(selected,selected.skill1,nullvector,GLIDE + IGNORE_ME);
wait(1);
}

}