object oItem;
/*   Script generated by
Lilac Soul's NWN Script Generator, v. 2.1

For download info, please visit:
http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625    */

//Put this OnClick or OnFailToOpen
void GetHasKey()
{

object oPC = GetClickingObject();

if (!GetIsPC(oPC)) return;

if (GetItemPossessedBy(oPC, "WinespringRoomKey")!= OBJECT_INVALID)
   {
   oItem = GetItemPossessedBy(oPC, "WinespringRoomKey");

   if (GetIsObjectValid(oItem))
      DestroyObject(oItem);

   // Delete variable so we can cycle through key scripts all over again
   DeleteLocalInt(oPC, "removekey");

   }

else if (GetItemPossessedBy(oPC, "WinespringRoomKey2")!= OBJECT_INVALID)
   {
   oItem = GetItemPossessedBy(oPC, "WinespringRoomKey2");

   if (GetIsObjectValid(oItem))
      DestroyObject(oItem);

   // Delete variable so we can cycle through key scripts all over again
   DeleteLocalInt(oPC, "removekey");

   }
else if (GetItemPossessedBy(oPC, "WinespringRoomKey3")!= OBJECT_INVALID)
   {
   oItem = GetItemPossessedBy(oPC, "WinespringRoomKey3");

   if (GetIsObjectValid(oItem))
      DestroyObject(oItem);

   // Delete variable so we can cycle through key scripts all over again
   DeleteLocalInt(oPC, "removekey");

   }
else if (GetItemPossessedBy(oPC, "WinespringRoomKey4")!= OBJECT_INVALID)
   {
   oItem = GetItemPossessedBy(oPC, "WinespringRoomKey4");

   if (GetIsObjectValid(oItem))
      DestroyObject(oItem);

   // Delete variable so we can cycle through key scripts all over again
   DeleteLocalInt(oPC, "removekey");

   }
else if (GetItemPossessedBy(oPC, "WinespringRoomKey5")!= OBJECT_INVALID)
   {
   oItem = GetItemPossessedBy(oPC, "WinespringRoomKey5");

   if (GetIsObjectValid(oItem))
      DestroyObject(oItem);

   // Delete variable so we can cycle through key scripts all over again
   DeleteLocalInt(oPC, "removekey");

   }
else if (GetItemPossessedBy(oPC, "WinespringRoomKey6")!= OBJECT_INVALID)
   {
   oItem = GetItemPossessedBy(oPC, "WinespringRoomKey6");

   if (GetIsObjectValid(oItem))
      DestroyObject(oItem);

   // Delete variable so we can cycle through key scripts all over again
   DeleteLocalInt(oPC, "removekey");

   }
else
   {
    // Delete variable so we can cycle through key scripts all over again
    DeleteLocalInt(oPC, "removekey");
   }
}