
Untitled
Guest 191 10th May, 2024
macro(10, "Stack Items", function()
local containers = g_game.getContainers()
local toStack = {}
for index, container in pairs(containers) do
if not container.lootContainer then
for i, item in ipairs(container:getItems()) do
if item:isStackable() and item:getCount() < 1000 then
local stackWith = toStack[item:getId()]
if stackWith then
local stackCount = math.min(1000 - stackWith[2], item:getCount())
g_game.move(item, stackWith[1], stackCount)
return
end
toStack[item:getId()] = { container:getSlotPosition(i - 1), item:getCount() }
end
end
end
end
end)
To share this paste please copy this url and send to your friends
RAW Paste Data