void main() { // start main object oPC = GetExitingObject(); object oArea = GetArea(OBJECT_SELF); int nPCFlag = FALSE; if(GetIsPC(oPC)) { // start main if object oObject = GetFirstObjectInArea(oArea); while(GetIsObjectValid(oObject)) { //start while loop if(GetIsPC(oObject)) { //start if nPCFlag = TRUE; break; // leave while loop if a PC is in the area } // end if else { //start else oObject = GetNextObjectInArea(oArea); } // end else } // end while if(nPCFlag == FALSE) { object oStore = GetFirstObjectInArea(oArea); while(GetIsObjectValid(oStore)) { int nObjectType = GetObjectType(oStore); if(nObjectType == OBJECT_TYPE_STORE) { object oItem = GetFirstItemInInventory(oStore); while(GetIsObjectValid(oItem)) { int nItemFlag = GetLocalInt(oItem, "PCItem"); if(nItemFlag != 0) { if(nItemFlag < 1) { nItemFlag++; SetLocalInt(oItem, "PCItem", nItemFlag); } else { DestroyObject(oItem); } } oItem = GetNextItemInInventory(oStore); } // end second while } // end if oStore = GetNextObjectInArea(oArea); } // end first while } // end if } // end main if } // end main