The following code is in the AI action.
I the player sees the AI "seen" is set to 1, otherwise it is 0:
Code:
var seen;	c_scan(player.x,player.pan,vector(90,90,5000),SCAN_ENTS);//switch state is found player	
			if(you)
			{
				if(you.typ == 1)
				{
					if(you.typ_id == my.typ_id)
				{seen = 1;}else{seen = 0;}
				}
				else{seen = 0;}
			}
			else{seen = 0;}



If the player looks a diffrent direction, seen for some reason doesn`t change back to 0.