I'm very new to this whole scripting thing and only know a few very basic things, so any help is appreciated.
I've been lurking for a while now looking on how to script a "Scary Door" properly. I saw some threads which did help, it's now functioning properly, slamming shut when the player enters the area I specified. 
However, the area still triggers the whole event of slamming and sanity damage when the player enters the area even if the door is closed. I want the event to not occur at all if the player enters the room, closes the door then enters the area.
I know this can be remedied somehow with the "GetSwingDoorClosed" function in an if else ladder, I've experimented with those to no avail, only receiving errors or no results. I believe it's a simple fix but I'm just unsure of how to do this, so again, any help is appreciated. 
Here is the existing script:
////////////////////////////
// Run first time starting map
void OnStart()
{
  
    PlayMusic("10_amb.ogg", true, 1.0f, 0, 0, true);
    SetPlayerLampOil(0); 
    
    SetEntityPlayerInteractCallback("Door1", "InteractedWithDoor", true);
    AddEntityCollideCallback("Player", "AreaDoorSlam1", "DoorSlam", true, 1);
    
     
}
void InteractedWithDoor(string &in entity)  
{
PlaySoundAtEntity("Grunt", "notice.snt", "AreaGrunt", 0, false);
}
void DoorSlam(string &in asParent, string &in asChild, int alState)
{
  
  StartPlayerLookAt("Door1", 4, 5, "");
  AddTimer("Slam", 0.5f, "TimerSlamDoor");
  
}
void TimerSlamDoor(string &in asTimer)
{
    SetSwingDoorClosed("Door1", true, true);    
    PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);        
    GiveSanityDamage(5.0f, true);
    AddTimer("Stoplook", 1.0f, "PlayerStopLook");
}
void PlayerStopLook(string &in asTimer)
{
//Player stops looking at object
StopPlayerLookAt();
}
     
        
   
////////////////////////////[/quote]
// Run when entering map
void OnEnter()
{
I would appreciate it greatly if someone could point out where this code needs to be. Thanks in advance. 
