//:: From David Gaider's scripting FAQ and tutorial: // set in a door's OnHeartbeat script, this will cause // it to close and lock itself at dusk // and unlock itself at dawn void main() { if (GetIsDusk() && GetIsOpen (OBJECT_SELF)) { ActionCloseDoor (OBJECT_SELF); // SetLocked is set in an ActionDoCommand because we // want it to be in the door's queue... we want the // ActionCloseDoor to be completed before locking the // door. ActionDoCommand (SetLocked (OBJECT_SELF, TRUE)); } else if (GetIsDawn() && GetLocked (OBJECT_SELF)) { SetLocked (OBJECT_SELF, FALSE); } }