Your browser does not support JavaScript or its disabled!
Please turn it on, or be aware that some features on this website will not work correctly.
86
Drop extra pots #59
This was requested, only quickly tested let me know if any issues.
622b | 20 lines.
local totalPots = 400
local potId = 237
macro(1000, "Drop extra pots", function()
  local pots = player:getItemsCount(potId)
  if pots > totalPots then
    local toDrop = pots - totalPots
    for _, container in pairs(g_game.getContainers()) do
      for __, item in ipairs(container:getItems()) do
        if item:getId() == potId then
          if toDrop > item:getCount() then
			toDrop = toDrop - item:getCount()
            g_game.move(item, player:getPosition(), item:getCount())
          else
            return g_game.move(item, player:getPosition(), toDrop)
          end
        end
      end
    end
  end
end)

05 Oct 2021