RequestMoveItem

From ESOUI Wiki

Jump to: navigation, search

This is a protected function. It must be called using CallSecureProtected to avoid throwing an error.

This function attempts to move some or all of an item stack from one bag slot to another. It can be used to move items within a single bag, to split an item stack within a single bag, or to transfer items from one bag to another (though the game may impose limitations on this).

Note that this function doesn't carry out the move operation instantly. In fact, it may take several frames for the move to actually occur.

Contents

Arguments

sourceBagId
A number representing the bag that an item should be moved from; it must be one of the built-in Bag values.
sourceSlotIndex
The numeric index of the slot that an item should be moved from. For most bags, this is a number ranging from 1 to the size of the bag.
targetBagId
A number representing the bag that an item should be moved to; it must be one of the built-in Bag values.
targetSlotIndex
The numeric index of the slot that an item should be moved to. For most bags, this is a number ranging from 1 to the size of the bag.
count
How many of the item should be moved.

Syntax

CallSecureProtected("RequestMoveItem", sourceBagIndex, sourceSlotIndex, targetBagIndex, targetSlotIndex, count)

Notes

As stated above, this function doesn't actually carry out a move operation immediately. Among other things, this means that calling HasItemInSlot on the target bag slot will continue to show that slot as empty. If you try to split multiple stacks at a time, using FindFirstEmptySlotInBag or a similar function to find a bag slot to move to, then your different attempts at splitting stacks will conflict and fail.

If you need to split multiple stacks, then you will also need to keep track of what bag slots you're splitting stacks to, and when you try to find a free slot to split to, you will need to ensure that it isn't a slot you've already used. You will also need an EVENT_INVENTORY_SINGLE_SLOT_UPDATE event listener, so that you can tell when a stack has actually split and its slot is safe to work with again. Even after all this, there is still the chance that you'll get in another add-on's way (or vice versa) if you and it try to split stacks at the same time.

And of course, all of the above also applies to any attempt at moving an item within a bag or between bags.

External links

Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox