^That will instantly remove your item if you pick it up the first time.
You need loop though inventory and check if unit has a item of same type
AND item in InventoySlot[loopInt] is not item being manipulated.
If yes, you add the charges of item being manipulated to charges of item in InventoySlot[loopInt] and further you remove item being manipulated.
Have no time atm to make an example, and only system I found quickly is this:
http://www.hiveworkshop.com/forums/.../?prev=of=updateline&search=split&d=list&r=20