SplitStackInto

Bug reports and feature requests. New features can only be added to the current development version. Bug-fixes may be back-ported.

Current release: 099 / Current development: 100
Post Reply
RusseL
Forum Regular
Posts: 368
Joined: Fri Feb 20, 2009 8:30 pm

SplitStackInto

Post by RusseL » Mon Feb 11, 2013 4:17 am

Hello,

I've tried to use item.SplitStackInto (container, amnt), but it doesn't work at all for me.
I get everytime the same message "Could not add new stack to container", and "amnt" of this item disappear.
What is wrong?
I need this function for scripted merchant handlers... for example I don't know how can i subtract 10 reagents from a merchants sell list and move them to characters backpack:)

rev 605 from svn.

RusseL
Forum Regular
Posts: 368
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL » Mon Feb 11, 2013 10:11 am

Second bug:
if i have a stack of more than 10 items, and use s_tack.SplitStackInto(me.backpack, 10, 0) on it - i get "Could not add new stack to container", and 10 items from this stack disappear
If i have a stack of 10 items, and use s_tack.SplitStackInto(me.backpack, 10, 0) on it - i get "Could not add new stack to container", but stack remains.

Third bug:
item must be updated after SplitStackInto was used.
1.jpg

Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: SplitStackInto

Post by Terciob » Tue Feb 12, 2013 6:57 am

tested on last rev 621, bugs confirmed.

xeon
Forum Regular
Posts: 333
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: SplitStackInto

Post by xeon » Wed Feb 13, 2013 12:52 am

Container is locked?
Are you holding the item in your "hands" (drag)?
Try to do a ReserveItem() on both container and item, checking also its return code to be sure to have reserved the objects to the script.

RusseL
Forum Regular
Posts: 368
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL » Wed Feb 13, 2013 2:40 am

xeon wrote:Container is locked?
Are you holding the item in your "hands" (drag)?
Try to do a ReserveItem() on both container and item, checking also its return code to be sure to have reserved the objects to the script.
No.
No.
No.
;)

kevin
POL Developer
Posts: 50
Joined: Wed Sep 29, 2010 3:47 pm
Contact:

Re: SplitStackInto

Post by kevin » Tue Feb 26, 2013 5:43 pm

all three of those bugs should be fixed with rev 625 using this script to test:

Code: Select all

use uo;

program test(who)
    var item, res;

    item := CreateItemAtLocation(who.x,who.y,who.z, 0xeed, 1000);
    res := item.SplitStackInto(who.backpack,1000,1);
    print("Result 1: "+res);

    item := CreateItemAtLocation(who.x,who.y,who.z, 0xeed, 1000);
    res := item.SplitStackInto(who.backpack,500,1);
    print("Result 2: "+res);

    item := CreateItemAtLocation(who.x,who.y,who.z, 0xeed, 1000);
    res := item.SplitStackInto(who.backpack,1000);
    print("Result 3: "+res);

    item := CreateItemAtLocation(who.x,who.y,who.z, 0xeed, 60000);
    res := item.SplitStackInto(who.backpack,59000);
    res := item.SplitStackInto(who.backpack,1000);
    print("Result 4: "+res);
endprogram
Results:
one stack of 3.5k in backpack from SplitStackInto() calls #1,2,3,5 ; one stack of 59k in backpack from call #4, one stack of 500 on ground from call #2

RusseL
Forum Regular
Posts: 368
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL » Tue Mar 05, 2013 9:18 am

another bug - try to use SplitStackInto(me.backpack, 1)); at non-stackable item ;)
Attachments
spellbooks.jpg
spellbooks.jpg (156.92 KiB) Viewed 2840 times

RusseL
Forum Regular
Posts: 368
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL » Sun Apr 14, 2013 2:22 pm

up! fix it please!

Tomi
POL Developer
Posts: 475
Joined: Tue Feb 21, 2006 5:08 pm

Re: SplitStackInto

Post by Tomi » Tue Sep 17, 2013 12:15 pm

Fixed in the last revision

RusseL
Forum Regular
Posts: 368
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto One more bug

Post by RusseL » Mon May 05, 2014 2:00 pm

Here we go again.
Same story with SplitStackAt
splitstackat_Bug.jpg
SplitStackAt(x,y,z,realm,amount) bug demo

Tomi
POL Developer
Posts: 475
Joined: Tue Feb 21, 2006 5:08 pm

Re: SplitStackInto

Post by Tomi » Tue May 06, 2014 5:38 am

I added some missing updaters to SplitStackAt method in the last revision
I tested this with a simple cmd

Code: Select all

var stack_i := CreateItemInInventory( character.backpack, 0x1f14, 100 );

stack_i.SplitStackAt( character.x, character.y, character.z, character.realm, 10 );
Working correctly for me ( did not give a try before the changes I made, but if it still doesnt work for you, check that you tiledata and tiles.cfg are correct because its looking from there if the item is stackable

RusseL
Forum Regular
Posts: 368
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL » Fri May 09, 2014 3:06 am

Thanks Tomi, looks like it works properly now

Post Reply