Here is a suggested (untested) code to try. You may have to play with the numbers a bit, but it should get you started.
Code:

function turn_toward_target
{
var original_direction[3];
var new_direction[3];
var pan_difference;
var pan_direction;

vec_set(original_direction,my.pan);
vec_set(temp,your.pos);
vec_sub(temp,my.pos);
vec_to_angle(new_direction,temp);

pan_difference = (360-new_direction.x) - (360-original_direction.x);
if((pan_difference > 0) && (abs(pan_difference) < 180))
{
pan_direction = 1;
}
else
{
pan_direction = -1;
}

while(my.pan != new_direction.x)
{
my.pan += pan_direction; // adjust angle increment by multiplying with 0.1 .. 10
wait(-time_step); // adjust turn speed by multiplying with 0.01 .. 100
wait(1);
}
}