Macro for Dual Gatherers

Macro for Dual Gatherers

by tipsey » Mon Mar 14, 2016 10:16 pm

Hello, I chose to take herbalism and mining to start off with on this server and i searched for a long time to try and find a macro that would allow me to switch tracking between the two with one button.

I was unsuccessful, so I decided to make my own :D

/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 :D
tipsey
Tester
 

Re: Macro for Dual Gatherers

by cyklon » Tue Mar 15, 2016 8:47 pm

Why make it so complex?

/run if buffed("Find Herbs", 'player') then CastSpellByName("Find Minerals") else CastSpellByName("Find Herbs") end;
User avatar
cyklon
Senior Sergeant
Senior Sergeant
 

Re: Macro for Dual Gatherers

by AfterAfterlife » Wed Mar 16, 2016 12:29 am

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)
AfterAfterlife
Grunt
Grunt
 

Re: Macro for Dual Gatherers

by cyklon » Wed Mar 16, 2016 1:16 am

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)


been usingit since lvl 5,, works perfect

maby it depends on SuperMacro
User avatar
cyklon
Senior Sergeant
Senior Sergeant
 

Re: Macro for Dual Gatherers

by Dreez » Wed Mar 16, 2016 11:20 am

yes "buffed" does require supermacro

and I doubt that timer macro will work as CastSpellByName is protected to only work on keypresses not on timers or events
Dreez - PvP server
<Endzeit>
User avatar
Dreez
Knight-Lieutenant
Knight-Lieutenant
 

Re: Macro for Dual Gatherers

by AfterAfterlife » Wed Mar 16, 2016 2:19 pm

Dreez wrote:I doubt that timer macro will work as CastSpellByName is protected to only work on keypresses not on timers or events

Oh, thanks for clarifying me.
AfterAfterlife
Grunt
Grunt
 

Re: Macro for Dual Gatherers

by Lebroski » Wed Mar 16, 2016 9:24 pm

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
Lebroski
Private
Private
 

Re: Macro for Dual Gatherers

by Dreez » Wed Mar 16, 2016 11:28 pm

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

this however stops working properly if you press it more than once every 1.5 seconds
Dreez - PvP server
<Endzeit>
User avatar
Dreez
Knight-Lieutenant
Knight-Lieutenant
 


Return to Addons & macros