I'm coming along with this, but I need to know something to see if my current attempt is fruitless.
Walking an inventory gets you base object IDs. I can easily compare two base object IDs to see if the item has changed (within a margin of tolerance, I'd think).
What I can't figure out is whether there is a way to have the script eject an item from the container based on what it's found by walking the inventory. MoveTo seems to only work on references, unless I'm misreading things entirely, and since the ObjectID is already stored as a "ref" I can't see any way to convert it to a reference that MoveTo will work on.
I'm told that there will be some more inventory functions added into the next version, so what I'm wondering is if there is a workaround to have a script eject my item, or if I can give up on this and wait till v19.
For explanation, I want the script to scan for a helmet, log the first helmet it finds, and then...if it finds a second helmet...compare the two and eject the first if the second one is different from the first. I've thought of two possible ways to make the comparison, but no way to pass the information needed to eject the helmet.