/* Ok, this one will check if the correct item has been placed in a container, then fire an event. It goes in the OnClosed slot.

This one will cycle though all the items in the container and if the right one is in there, the event will fire and destroy the object. I'm still trying to work on one that will ONLY examine the first object, but haven't figured that out yet. */

void main()
{
if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)
{
return;
}
object obj = GetFirstItemInInventory();
while (obj != OBJECT_INVALID) {
if (GetTag(obj) == "TEST") {
effect eMind = EffectVisualEffect(VFX_FNF_WAIL_O_BANSHEES);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eMind, GetLocation(OBJECT_SELF), 0.0);
DestroyObject(obj, 0.0);
{
object oCreature = GetLastClosedBy();
GiveXPToCreature (oCreature, 100);
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
}
}
obj = GetNextItemInInventory();
}
}