//Script Name: day_night_check
//////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On:   8/19/08
/////////////////////////////////////////
/*
This script checks the time of day,
and if it's day, the door unlocks,
otherwise it tells the PC's why
they cannot enter.
*/
////////////////////////////////////////


//Put this script in the OnFailToOpen Event of the Day / Night Door
void main()
{

object oPC = GetClickingObject();

if (!GetIsPC(oPC)) return;

if (GetIsDay())
   {
   SetLocked(OBJECT_SELF, FALSE);

   ActionOpenDoor(OBJECT_SELF);

   DelayCommand(15.1, ActionCloseDoor(OBJECT_SELF));
   }
else if (GetIsNight())
   {
   ActionSpeakString("This door is barred from the inside and is unoppenable.");
   }
else
   {
   //Debug Message to DMs (This should NEVER Happen)
   SendMessageToAllDMs("Error on Day / Night Door Script, you need to check the (day_night_check) script");
   }

}