void main() { object oClicker = GetClickingObject(); object oTarget = GetTransitionTarget(OBJECT_SELF); location lLoc = GetLocation(oTarget); string sKey = "kdbkey"; object firstItemInInv; object currentItemInInv; firstItemInInv = GetFirstItemInInventory(oClicker); currentItemInInv = firstItemInInv; SetLocalInt(OBJECT_SELF, "KEY_CHECK", FALSE); // Insure they have at least one object if(currentItemInInv != OBJECT_INVALID) { do { string sItem = GetTag(currentItemInInv); // get the tag of the Item string s1 = GetStringLeft(sItem, 9); // get the first 9 chartacters if(s1 == sKey) { SetLocalInt(OBJECT_SELF, "KEY_CHECK", TRUE); // Set Local Int to True } // get next item currentItemInInv = GetNextItemInInventory(oClicker); // loop while we have a new item to check }while(currentItemInInv != OBJECT_INVALID && currentItemInInv != firstItemInInv); } if (GetLocalInt(OBJECT_SELF, "KEY_CHECK") == 1) { AssignCommand(oClicker,JumpToLocation(lLoc)); } else { SpeakString( "You need to have a certain key to access this area."); } }