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: 375
Joined: Fri Feb 20, 2009 8:30 pm

SplitStackInto

Post by RusseL »

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: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL »

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 »

tested on last rev 621, bugs confirmed.
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: SplitStackInto

Post by xeon »

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: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL »

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: 53
Joined: Wed Sep 29, 2010 3:47 pm
Contact:

Re: SplitStackInto

Post by kevin »

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: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL »

another bug - try to use SplitStackInto(me.backpack, 1)); at non-stackable item ;)
Attachments
spellbooks.jpg
spellbooks.jpg (156.92 KiB) Viewed 8017 times
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL »

up! fix it please!
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

Re: SplitStackInto

Post by Tomi »

Fixed in the last revision
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto One more bug

Post by RusseL »

Here we go again.
Same story with SplitStackAt
SplitStackAt(x,y,z,realm,amount) bug demo
SplitStackAt(x,y,z,realm,amount) bug demo
Tomi
POL Developer
Posts: 478
Joined: Tue Feb 21, 2006 5:08 pm

Re: SplitStackInto

Post by Tomi »

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: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: SplitStackInto

Post by RusseL »

Thanks Tomi, looks like it works properly now
Post Reply