Untitled

 avatar
unknown
plain_text
17 days ago
1.4 kB
4
Indexable
-- === KONFIGURACJA ===
local itemToDetectId = 5096       -- ID przedmiotu, który ma się pojawić
local itemToDetectPos = {x = 998, y = 990, z = 6}  -- Pozycja, gdzie ma się pojawić przedmiot

local leverPos = {x = 998, y = 992, z = 6}         -- Pozycja dźwigni, na którą klikamy
-- =====================

w = macro(10, "Auto Dźwignia (jednorazowa)", function(macro)
    local tile = g_map.getTile(itemToDetectPos)
    if not tile then return end

    -- Optymalizacja: sprawdzamy, czy przedmiot jest obecny na kratce
    for _, item in ipairs(tile:getItems()) do
        if item:getId() == itemToDetectId then
            -- Zamiast szukać tile za każdym razem, sprawdzamy tylko raz
            local leverTile = g_map.getTile(leverPos)
            if leverTile then
                local topUseThing = leverTile:getTopUseThing()
                if topUseThing then
                    use(topUseThing)
                    macro:setOff()  -- automatyczne wyłączenie makra
                    return
                end
            end
        end
    end
end)

addIcon("cI", {text = "DZWIGNIA SKRYPT", switchable = false, moveable = false}, function()
  if w:isOff() then
    w:setOn()  -- Użyj setOn() zamiast isOn()
  else
    -- Opcjonalnie możesz dodać logikę wyłączania makra, jeśli chcesz
    -- w:setOff()
  end
end)
Editor is loading...
Leave a Comment