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.
SplitStackInto
Re: SplitStackInto
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.
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.
Re: SplitStackInto
tested on last rev 621, bugs confirmed.
Re: SplitStackInto
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.
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.
Re: SplitStackInto
No.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.
Re: SplitStackInto
all three of those bugs should be fixed with rev 625 using this script to test:
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
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
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
Re: SplitStackInto
another bug - try to use SplitStackInto(me.backpack, 1)); at non-stackable item
- Attachments
-
- spellbooks.jpg (156.92 KiB) Viewed 8017 times
Re: SplitStackInto
up! fix it please!
Re: SplitStackInto
Fixed in the last revision
Re: SplitStackInto One more bug
Here we go again.
Same story with SplitStackAt
Same story with SplitStackAt
Re: SplitStackInto
I added some missing updaters to SplitStackAt method in the last revision
I tested this with a simple cmd
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
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 );
Re: SplitStackInto
Thanks Tomi, looks like it works properly now