• 0

    posted a message on herb/mining tracking addon!

    Im making an automatic tracker for an alt with both herbalism and mining! This is my first WoW addon, and got no experience with LUA or wow API before this.

     

    In my LUA code ive got a a function that repeats every 4 seconds, which work perfectly until i login in a rested zone (inn or capital).

    this is the function:

    local function tracking()
        if UnitIsEnemy("player","target") then
        else
            if IsResting() then
            else
                if i == 0 then
                    CastSpellByID(2580);
                    i = i + 1;
                elseif i == 1 then
                    CastSpellByID(2383);
                    i = i - 1;
                end
            end
        end
    end

    As you can see Ive made it so if im targeting a hostile monster it shouldnt loop, so i dont get GCDs when Im fighting, ive also added so i dont use it while getting rested, to not screw with me while doing stuff in capitals.
    This works perfectly if I login (or do a /reload) while not getting rested, moving into an Inn or a capital will cancel the whole loop, and when exiting it will continue tracking. But if I login while getting rested I must do a /reload outside for it to start tracking!

     

    the way I run the function is:

    if IsSpellKnown(2580) and IsSpellKnown(2383) then
        C_Timer.NewTicker(4, tracking)
    end

     Are there any obvious reasons my addon wouldnt work after logging in to the game while getting rested exp?

    Posted in: AddOn HELP!
  • To post a comment, please or register a new account.