Suppose you have two bags. In the first you put 5000 goldcoins, and 100 goldcoins in the second.
Next you do a script like this:
Code: Select all
var bag1 := target(who);
var bag2 := target(who);
foreach oItem in (EnumerateItemsInContainer(bag1, ENUMERATE_ROOT_ONLY))
MoveItemToContainer(oItem, bag2);
endforeach
If I put some print() inside the canInsert and onInsert scripts, I see that:
Shouldn't POL recognize an existing stack of the same objtype in the target container and try a MOVETYPE_COREMOVE (value 1) but with INSERT_INCREASE_STACK (value 2)? Instead it does a simple MOVETYPE_COREMOVE with INSERT_ADD_ITEM, so simply moving the item.can_insert(): container=bag movetype=1 inserttype=1 adding_item=<appobj:ItemRef> existing_stack=<uninitialized object> amt_to_add=<uninitialized object>
can_insert(): returns 1
on_insert(): container=bag movetype=1 inserttype=1 adding_item=<appobj:ItemRef> existing_stack=<appobj:ItemRef> amt_to_add=5000
The net result is that the coins doesn't get stacked
If this is the correct behavior please tell me.