like lionz said, the easiest way is to use a function. (I really don't like updating text objects every tick).
I simplified the logic in your example a bit and added a fuction to update the correct text_value instance.
In event 6 you don't need to pick the top items instance because the event is triggered by drag-and-drop so only one instance is already selected.
In event 8 you were checking if "items" value was >= stack_size, but that should be "item".
I calculate surplus by adding the item.value + items.value - stack_size, if that results in a negative number then return zero. This can be done in one action using Max()... and use Min() to set the new value to item.value + items.value, or stack_size, and then use the function to update the text_value instances.
https://www.rieperts.com/games/forum/InventoryTest2.c3p