Seems that the trig variable is undefined and you cant call the waittill func on it. Try to check it so
PHP Code:
main()
{
    
door getent ("Secret","targetname");
    
trig getent ("open","targetname");
    while (
1)
    {
        if(
isDefined(trig) && isDefined(door))
        {
            
trig waittill ("trigger");
            
door rotateyaw (-80,3,1,1);
            
door waittill ("rotatedone");
            
wait (2.5);
            
door rotateyaw (80,3,1,1);
            
door waittill ("rotatedone");
            
wait (2);
        }
        else
        {
             
iprintlnbold("undefined object(s)");
             
wait 1;
        }
    }

and if u can see the error msg thats the problem