You can create a trigger and end it that way..
Example.
WestTriggerOne = createTrigger ["EmptyDetector", SomePosition];
WestTriggerOne setTriggerActivation ["WEST", "PRESENT", true];
WestTriggerOne setTriggerStatements ["this", "On_Act_Statement", "On_Deact_Statement"];
WestTriggerOne setTriggerType "END2";
more about triggers look at the Bis Wiki