Page 1 of 1

SplitBagItem broken?

Posted: Sat Mar 30, 2013 8:20 am
by Cindy
I've been trying to fuse some Wind Elements, with no success (using element fuser script of Rock)

Debugged it to

Code: Select all

RoMScript("SplitBagItem("..item.BagId..","..need..")")
The ID and number are correct, so I tried to run it in ROM as /run SplitBagItem(61,3) i moved it to first slot. Got a red message about "Item error: cannot split the item stack". Can anyone confirm that they nerfed this API recently?

I've used the element fuser script a few weeks ago successfully.

Re: SplitBagItem broken?

Posted: Sat Mar 30, 2013 9:13 am
by rock5
Splitting does till work. Note, '61' might not be the bagid. Use this instead to test it.

Code: Select all

/run SplitBagItem(GetBagItemInfo(1),3)
I was able to test it with Wind Elements. It worked.

Re: SplitBagItem broken?

Posted: Sat Mar 30, 2013 9:18 am
by lisa
I could be wrong but that BagId is the one that is random on each bag, so 61 won't be first slot of bag 1.

--=== LOL ===--

I tested it and went to post and saw rock already did exactly what I was going to post.

I tested with

Code: Select all

/script SplitBagItem( 1 , 5 );
first slot of item shop bag.

Re: SplitBagItem broken?

Posted: Fri Apr 05, 2013 4:31 pm
by Cindy
thanks!

Re: SplitBagItem broken?

Posted: Fri Aug 02, 2013 5:51 am
by Cindy
So this problem still exists. When I run the element fuser script, on some of my characters this works but on others it doesn't:

Code: Select all

local function Fuse(id,num)
		-- Move items to magic box
		local need = num
		local magicslot = 51
		print("fuse%s-%s", id, num )
		for i = 61,240 do
			local item = inventory.BagSlot[i]
			item:update()
			if item.Available and (not item.Empty) and item.Id == id then
				printf("got @ "..i)
				if item.ItemCount > need then
					printf("split "..need.." of "..item.BagId.." ")					
					RoMScript("SplitBagItem("..item.BagId..","..need..")")
					rest(1000)
					need = 0
				else
					item:pickup()
					need = need - item.ItemCount
				end
				yrest(200)
				inventory.BagSlot[magicslot]:pickup() yrest(200)
				magicslot = magicslot + 1
			end
			if need == 0 then break end
		end
		yrest(500)		
		-- Press 'Confirm'
		RoMScript("MagicBoxRequest()");

		yrest(500)
		EmptyMagicbox()
		inventory:update()
	end
Output:
got @ 152split 3 of 175 fuse%s-%s 241479 3

I paused the bot mid execution, and using the values displayed (for bag id) i manually executed /script SplitBagItem(175,3). This worked in that 3 elements were broken off the staff and were hovering on the cursor. When the bot runs the cursor doesn't change. So I thought maybe this is a timing issue, added the rest(1000). Unfortunately, it still does not work.

(Note the code does validate that slotid and bagid are different).

Any ideas/suggestions?

Re: SplitBagItem broken?

Posted: Fri Aug 02, 2013 6:23 am
by rock5
It's a bit strange. If it works on some characters then that would imply that the code is correct but there is something about some characters that makes it not work. If it consistently doesn't work on a particular character then you need to play around with it until you figure out why. Try adding print statement in various positions to print out values and see if they have the values you expect. Add player:sleep() in a few places to pause the script so you can check each step has been done before continuing. See if there are any warning messages appearing saying why it's not working.

Hope that helps.