Macro to display / craft

I often want to farm something which can be turned into something else that takes up slightly less bag space. I developed a macro that will show how many of the farmed item you have and, when clicked, will craft whatever it turns into. In this example I’m mining for solid stones to be turned into solid blasting powder.

#showtooltip Solid Stone
/run local n; for i=1,GetNumTradeSkills() do n,,= GetTradeSkillInfo(i); if (n==“Solid Blasting Powder”) then DoTradeSkill(i); end; end;

You could do something similar for ruined leather scraps:

#showtooltip Ruined Leather Scraps
/run local n; for i=1,GetNumTradeSkills() do n,,= GetTradeSkillInfo(i); if (n==“Light Leather”) then DoTradeSkill(i); end; end;

Note that you don’t need Engineering or Leatherworking currently open for this to work, but it does need to be the most recent profession window you have opened. Otherwise clicking it will do nothing.

If anyone knows how to set the profession that GetNumTradeSkills, etc. looks through, PLEASE LET ME KNOW. I’ve spent a couple hours reading API docs and Googling and I can’t find anything.

Cheers, I hope this helps someone!

I have a similar macro for making mooncloth. I think the easiest solution is to just use the profession skill above the other part of the macro. For example this is my macro for mooncloth:

/use Tailoring
/run for i=1,GetNumTradeSkills() do if GetTradeSkillInfo(i)=="Mooncloth" then DoTradeSkill(i, GetItemCount("Mooncloth")/5) break end end 

The only downside I guess is that it opens the crafting window and you have to close it again but that doesn’t bother me too much.

Oh, that’s totally fine. I was using some kind of CastByName thing that would open and close the Engineering window every time I clicked the button. It was maddening.

By the way if you make the following change it will craft all available whatevers:

#showtooltip Ruined Leather Scraps
/run local n,c; for i=1,GetNumTradeSkills() do n,_,c = GetTradeSkillInfo(i); if (n==“Light Leather”) then DoTradeSkill(i,c); end; end;

The change is adding c (for count) to the variable list that you collect from GetTradeSkillInfo(), then use it in DoTradeSkill().