You have to put the event function (scan_event) above the action of the door:
Code:
function scan_event
{
if(event_type == event_scan)
{
my.skill3 = 1;
}
}
action rotating_door
{
my.skill1 = 1; //-1 = open, 1 = closed
my.skill2 = my.pan; //the pan angle for the closedposition of the door
my.skill3 = 0; //0 = door not moving, 1 = door is moving
my.skill4 = 0; //current angle offset the door is while it is moving
my.enable_scan = ON;//turns on sensitivity to scans that hit it
my.event = scan_event;
while (me != NULL)
{
while(my.skill3)
{
if(my.skill4 >=90)
{
my.skill4 = 90;
my.skill1 = -1;
my.skill3 = 0;
}
else
{
if(my.skill4 <=0)
{
my.skill4 = 0;
my.skill1 = 1;
my.skill3 = 0;
}
}
my.pan = my.skill2 + my.skill4;
my.skill4 += my.skill1*2*time;
wait(1);
}
wait(1);
}
}