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:
Code:
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.
the way I run the function is:
Code:
if IsSpellKnown(2580) and IsSpellKnown(2383) then
C_Timer.NewTicker(4, tracking)
end
This works if I login out in the wilds, when entring an inn It will not do any new tracking, and when exiting it will continue the trackingloop.
When I login into the same inn the tracking will not change after leaving the inn and do a /reload
Are there any obvious things Ive missed?