Page 1 of 1
SplitStackInto
Posted: Wed Mar 05, 2014 2:38 pm
by RusseL
Hello everybody.
There is such function 'SplitStackInto'
As i understand it should be used with custom merchant handlers, but it is useless if it doesn't call container onInsert scripts like it MoveItemToContainer does.
"Calls the item's unequiptest and unequip scripts, if any.
Calls the container's canInsert and onInsert scripts, if any.
Calls the item's original container's (if any) canRemove and onRemove scripts, if any."
Please add it

Re: SplitStackInto
Posted: Thu Mar 06, 2014 6:37 am
by Tomi
Hello,
Those remove and insert scripts need to look into those why they are not there, should not be a big thing to add.
About that unequip script, I just wonder what is a stackable item that you can even equip ?
And good you noticed these, need to check that SplitStackAt method also has these called
Re: SplitStackInto
Posted: Thu Mar 06, 2014 6:55 am
by RusseL
Tomi wrote:
About that unequip script, I just wonder what is a stackable item that you can even equip ?
copied this info from MoveItemToContainer Docs

Looks like is no need to call equip/unequip here
i use splitstackinto not only on stackable items. if item is not stackable it just moves to players backpack.
easiest way to implement EVID_MERCHANT_SOLD
Code: Select all
var totally := 0;
foreach sold in ( ev.shoppinglist )
totally := totally + (sold.item.sellprice*sold.amount);
endforeach
if (ev.source.spendgold(totally))
foreach sold in ( ev.shoppinglist )
// SPLITSTACKINTO SHOULD CALL CONTAINER INSERT SCRIPT! OVERWEIGHT!
sold.item.SplitStackInto(ev.source.backpack, sold.amount);
endforeach
PrintTextAbovePrivate(me, "Total "+CStr(totally)+"gp", ev.source);
else
PrintTextAbovePrivate(me, "Not enough money", ev.source);
endif
Re: SplitStackInto
Posted: Mon Mar 31, 2014 2:41 pm
by RusseL
UP! High Priority!

Re: SplitStackInto
Posted: Mon May 05, 2014 12:59 am
by RusseL
Solved.
It calls canInsert script, but sends no CharRef as parameter, like other functions MoveItemToContainer etc.