Script I've posted has nothing to do with screen. ^^
It just turns "temp_ang" to target and then smoothly make's player's pan turn to "temp_ang".
Please, check your script, may be you using "temp_ang" somewhere? Or something like that.
Check where else you are using:
det_last_target.x
vectemp
temp_ang
my.pan
Other ways, I have no idea. Something must be wrong with your script, or with way you use the one I've posted.