Page 1 of 1

Problems with item:moveTo inventory

Posted: Mon Mar 13, 2023 3:53 am
by Andre235
i have a function in my secret garden script, that automatically moves the items to the itemshop bank, but it works not really good...
the script is running, every item appears at the mouse cursor, but only 20-30% of the items will be moved.
myabe it is an address or a timing problem. i tried to set a "yrest(1000)" after the "item:moveTo("isbank")" but no success with this.
can anybody help me or probably having a similar problem?

Code: Select all

		inventory:update();
		yrest(1000);

		for slot = 1, 240 do
			item = inventory.BagSlot[slot]
			if item and item.ItemShopItem then
				item:moveTo("isbank")
			end;
		end;
[/code

thank you :-)

Re: Problems with item:moveTo inventory

Posted: Mon Mar 13, 2023 7:34 am
by Andre235
me again:
i think i solved the problem...
at first: its bag slot 0-239, instead of 1-240.
and i played around with the item.max_stack address and now i got no issues and it moves the items completely...
here is my addresses.lua
addresses.lua
(9.17 KiB) Downloaded 55 times
@Admin: can you confirm it and put it to the git repository?

thank you an have fun :-)

Re: Problems with item:moveTo inventory

Posted: Tue Mar 14, 2023 6:05 pm
by Administrator
Thanks for the update.

I took a quick look at it and I see what's going on. It looks like they removed the max item stack value from the item structure itself (no idea where it was moved to at the moment). That's why the bot was no longer able to read the item max stack count.

When you updated the address, I'm guessing you kind of of tried a few things and noticed that 0x2c seemed to work for you. However, it looks like it is almost always causing the max stack to return as 0. Inside the
item:moveTo()
method, it tries to stack items when it can and it does this by checking if the item is stackable by testing if the max stack count is > 1; in this case, 0 is never greater than 1, and therefore it skips that piece of code, giving the impression it is working correctly.

I'll have to give it some thought and see if there's something better we can do. At the very least, we can disregard trying to stack the items.