• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

OTClient Macro for LEVEL/HOUR

tuduras

Well-Known Member
Joined
Jun 4, 2017
Messages
340
Solutions
2
Reaction score
58
Hello. Good ? good -

do have someone efficient macro to calculate level per hour.
Somethink like this in photo.
otc.webp

best regards!
 

Attachments

LUA:
-- Inicjalizacja danych (tylko raz przy starcie)
if not storage.expV5 then
    storage.expV5 = {
        sExp = exp(),
        sTime = os.time()
    }
end

-- Tworzymy Label w menu bota (półprzezroczyste tło, ładny tekst)
UI.Separator()
local expLabel = UI.Label("Exp/h: Czekam...")
expLabel:setColor("#00FF00") -- Zielony kolor

macro(1000, "Licznik Exp V5", function()
    local currentExp = exp()
    local level = level()
    
    if not currentExp or currentExp <= 0 then return end

    local timeDiff = os.time() - storage.expV5.sTime
    local expGained = currentExp - storage.expV5.sExp

    -- Obliczanie Exp/h
    local expPerHour = 0
    if timeDiff > 2 then
        expPerHour = math.floor((expGained / timeDiff) * 3600)
    end

    -- Wzór na exp do następnego poziomu
    local expForNextLevel = math.floor((50 / 3) * (level^3 - 6 * level^2 + 17 * level - 12))
    local expLeft = math.max(0, expForNextLevel - currentExp)
    
    local ttl = "N/A"
    if expPerHour > 0 and expLeft > 0 then
        local hours = expLeft / expPerHour
        local mins = math.floor((hours % 1) * 60)
        ttl = math.floor(hours) .. "h " .. mins .. "m"
    end

    -- Funkcja formatująca (np. 1.2kk)
    local function fmt(v)
        if v >= 1000000 then return string.format("%.2f", v / 1000000) .. "kk" end
        if v >= 1000 then return string.format("%.1f", v / 1000) .. "k" end
        return tostring(v)
    end

    -- Aktualizacja tekstu w panelu bota zamiast CTRL+T
    expLabel:setText("Exp/h: " .. fmt(expPerHour) .. " | TTL: " .. ttl)
end)

UI.Button("Resetuj Statystyki", function()
    storage.expV5.sExp = exp()
    storage.expV5.sTime = os.time()
    expLabel:setText("Exp/h: Zresetowano!")
end)
UI.Separator()

PS: may hang. testeed on otcv8
 

Similar threads

Back
Top