PoLDocs wrote:
program onremovescript(character, container, item, item_amount, movetype)
Item_amount parameter is missing here, instead it sends movetype in place of item_amount.
Since the script runs before the item is actually dragged, item.amount would return the original stack amount, not the amount that is being dragged.