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.
225
Drop item to Mouse #8
This will drop an item to mouse cursor position on hotkey press.
1.36kb | 44 lines.
hotkey("f1", "Drop item to Mouse", function()
    local tile = getTileUnderCursor()
    if tile then
        local pos = tile:getPosition()
        local itemToMouse = 3031
        for _, container in pairs(g_game.getContainers()) do
            for __, item in ipairs(container:getItems()) do
                if item:getId() == itemToMouse then
                    return g_game.move(item, pos, 1)
                end
            end
        end
    end
end)

hotkey("1", "Drop item to Mouse", function()
        local neighbours = {
            { x = 0, y = -1, z = 0 },
            { x = -1, y = -1, z = 0 },
            { x = -1, y = 0, z = 0 },
            { x = -1, y = 1, z = 0 },
            { x = 0, y = 1, z = 0 },
            { x = 1, y = 1, z = 0 },
            { x = 1, y = 0, z = 0 },
            { x = 1, y = -1, z = 0 }
        }
    local tile = getTileUnderCursor()
    if tile then
        local pos = tile:getPosition()
        local itemToMouse = 3031
        for _, container in pairs(g_game.getContainers()) do
            for __, item in ipairs(container:getItems()) do
                if item:getId() == itemToMouse then
					for k, v in pairs(neighbours) do
						local posN = { x = pos.x + v.x, y = pos.y + v.y, z = pos.z + v.z }
						g_game.move(item, posN, 1)
					end
					return
				end

			end
        end
    end
end)

Change the hotkey from f1 to whatever key you want. change itemToMouse with the item number.

01 Jan 2020