I was unsuccessful, so I decided to make my own
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
/run local x=0 if GetTrackingTexture() =="Interface\\Icons\\Spell_Nature_Earthquake" then x=1 end if x==0 then CastSpellByName("Find Minerals") else CastSpellByName("Find Herbs") end
Enjoy
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
|
![]() |
cyklon wrote:Why make it so complex?
/run if buffed("Find Herbs", 'player') then CastSpellByName("Find Minerals") else CastSpellByName("Find Herbs") end;
/run local f, t, e = CreateFrame("FRAME"), GetTime(), 0; f:SetScript("OnUpdate", function() e = GetTime() - t; if e > 1 then t = GetTime(); if UnitBuff("player", "Find Herbs") then CastSpellByName("Find Minerals"); else CastSpellByName("Find Herbs"); end; end; end;);
/run local f,t,e,c,g = CreateFrame("FRAME"),GetTime(),0,CastSpellByName,GetTime f:SetScript("OnUpdate", function() e = g - t if e > 1 then t = g if UnitBuff("player", "Find Herbs") then c("Find Minerals") else c("Find Herbs") end end end)
AfterAfterlife wrote:cyklon wrote:Why make it so complex?
/run if buffed("Find Herbs", 'player') then CastSpellByName("Find Minerals") else CastSpellByName("Find Herbs") end;
I'm pretty sure Vanilla API doesn't have "buffed" function. Instead of that, use UnitBuff("unit", "buffName"). Example: UnitBuff("player", "Find Herbs").
By the way, can you make a timer that switches between Find Herbs/Minerals every 1 second?
E.g.:
- Code: Select all
/run local f, t, e = CreateFrame("FRAME"), GetTime(), 0; f:SetScript("OnUpdate", function() e = GetTime() - t; if e > 1 then t = GetTime(); if UnitBuff("player", "Find Herbs") then CastSpellByName("Find Minerals"); else CastSpellByName("Find Herbs"); end; end; end;);
If the code above is too big for regular macros, try this one:
- Code: Select all
/run local f,t,e,c,g = CreateFrame("FRAME"),GetTime(),0,CastSpellByName,GetTime f:SetScript("OnUpdate", function() e = g - t if e > 1 then t = g if UnitBuff("player", "Find Herbs") then c("Find Minerals") else c("Find Herbs") end end end)
|
![]() |
|
![]() |
Dreez wrote:I doubt that timer macro will work as CastSpellByName is protected to only work on keypresses not on timers or events
/run if n~= 1 then CastSpellByName("Find Herbs") n=1 else CastSpellByName("Find Minerals") n=0 ;end
Lebroski wrote:If you don't use SuperMacro then this should work for you
- Code: Select all
/run if n~= 1 then CastSpellByName("Find Herbs") n=1 else CastSpellByName("Find Minerals") n=0 ;end
|
![]() |