SplitStackInto

Here you can post threads specific to the current release of the core (099)
Post Reply
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

SplitStackInto

Post 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 :)
Last edited by RusseL on Thu Mar 06, 2014 6:56 am, edited 1 time in total.
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

Re: SplitStackInto

Post 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
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post 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
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL »

UP! High Priority! :smashy:
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL »

Solved.
It calls canInsert script, but sends no CharRef as parameter, like other functions MoveItemToContainer etc.
Post Reply