New Crafting UI Macro Question

I’m trying to work on getting a macro set up for the new crafting system and personally trying to get it working for Dragon Isles Unravelling. The skill states “Select Item to Salvage” so I assume I should be using: C_TradeSkillUI.CraftSalvage

My current Macro looks like this:

/cast Tailoring /run C_TradeSkillUI.CraftSalvage(376562 [, math.floor(GetItemCount(193050)/5)],193050)`

But when I run that I get an error stating

[string "C_TradeSkillUI.CraftSalvage(376562, [ math.floor(GetItemCount(1..."]:1: unexpected symbol near '['

If I were to get rid of the [ ] then I would get the following error

[string "C_TradeSkillUI.CraftSalvage(376562, math.fl..."]:1: bad argument #3 to 'CraftSalvage' (Usage: C_TradeSkillUI.CraftSalvage(recipeSpellID [, numCasts], itemTarget))

I’ve tried this with C_TradeSkillUI.CraftRecipe and get similar results. Any assistance with this would be great as I’m not the most familiar with how macros work with the new crafting system.

[] denotes optional arguments. You don’t include them when calling the function.

/cast Tailoring
/run C_TradeSkillUI.CraftSalvage(376562,math.floor(GetItemCount(193050)/5),193050)

Thank you for that, it has actually helped me understand this a bit more, and that makes more sense. I tried doing what you suggested, and that’s when I get the error of Bad Argument #3. Should Dragon Isles Unravelling be considered salvage or recipe? When I try recipe I get this generic error:
Usage: C_TradeSkillUI.CraftRecipe(recipeSpellID [, numCasts, craftingReagents, recipeLevel, orderID])

1 Like

It’s salvage but your 3rd argument is wrong.

And looks like it’ll be a royal pain to use.

For item target, would that just be wanting the specific item in my bags? I’d have to know it’s slot ID for that wouldn’t I? Might not have enough space in a macro to even do what’s probably needed lol.

Yeah, if you click the link it tells you how to reference it.

Alright so I’m KIND OF able to get it working with the following.

/cast Tailoring
/run for slot = 1, C_Container.GetContainerNumSlots(5) do local itemLink = ItemLocation:CreateFromBagAndSlot(5, slot) if itemLink then C_TradeSkillUI.CraftSalvage(376562,200,itemLink) end end

But with this it only casts once instead of the 200 times I have set in the CraftSalvage function. I figure it has to do with the “end”'s at the end of the run. Also was thinking of putting the itemlink’s in an array and pulling each one in after it’s done it’s 200, but I am having issues referencing ItemLink from outside of the run even tho it’s set locally (Wish I knew more about LUA). I tried the following but it didn’t work because it couldn’t find ItemLink:

/cast Tailoring
/run for slot = 1, C_Container.GetContainerNumSlots(5) do local itemLink = ItemLocation:CreateFromBagAndSlot(5, slot) end
/run C_TradeSkillUI.CraftSalvage(376562,200,itemLink)

Here’s a macro that unravels Tattered Wildercloth.

/cast Tailoring
/run for bg=0,5 do for s=1,C_Container.GetContainerNumSlots(bg) do local lnk=ItemLocation:CreateFromBagAndSlot(bg,s) if lnk:IsValid() and C_Item.GetItemID(lnk) == 193050 then C_TradeSkillUI.CraftSalvage(376562,200,lnk) return end end end

You can change the 193050 for whatever item you want to salvage. And you can change the 376562 for whatever salvage you want to perform.

2 Likes