I need help with an auto trade macro

I found this macro for auto trading Healthstones and I cant get it to work. Can anyone help please?

/run for i=0,4 do for x=1,GetContainerNumSlots(i) do y=GetContainerItemLink(i,x) if y then if GetItemInfo(y)==“Minor Healthstone” then PickupContainerItem(i,x); DropItemOnUnit(“target”); return; end end end end
/click TradeFrameTradeButton

Update the function names to include the namespace:

Thank you for the reply. I have no idea how to do that. I don’t ever mess with Macros. I did check the link but im confused.

/run for i=0,4 do for x=1,C_Container.GetContainerNumSlots(i) do y=C_Container.GetContainerItemLink(i,x) if y then if GetItemInfo(y)=="Minor Healthstone" then C_Container.PickupContainerItem(i,x) DropItemOnUnit("target") break end end end end
/click TradeFrameTradeButton

[edit]
fixed syntax.

1 Like

Thank you so much

Does this still work for you? I get an error:

Message: [string "for i=0,4 do for x=1,C_Container.GetContain..."]:1: attempt to call field 'GetItemInfo' (a nil value)
Time: Wed Jun  7 21:24:28 2023
Count: 2
Stack: [string "for i=0,4 do for x=1,C_Container.GetContain..."]:1: attempt to call field 'GetItemInfo' (a nil value)
[string "=[C]"]: in function `GetItemInfo'
[string "for i=0,4 do for x=1,C_Container.GetContainerNumSlots(i) do y=C_Container.GetContainerItemLink(i,x) if y then if C_Container.GetItemInfo(y)=="Healthstone" then C_Container.PickupContainerItem(i,x) DropItemOnUnit("target") break end end end end"]:1: in main chunk
[string "=[C]"]: in function `RunScript'
[string "@Interface/FrameXML/ChatFrame.lua"]:2205: in function `?'
[string "@Interface/FrameXML/ChatFrame.lua"]:4933: in function <Interface/FrameXML/ChatFrame.lua:4879>
[string "=[C]"]: in function `ChatEdit_ParseText'
[string "@Interface/FrameXML/ChatFrame.lua"]:4596: in function `ChatEdit_SendText'
[string "@Interface/FrameXML/ChatFrame.lua"]:2986: in function <Interface/FrameXML/ChatFrame.lua:2979>
[string "=[C]"]: in function `UseAction'
[string "@Interface/FrameXML/SecureTemplates.lua"]:343: in function `handler'
[string "@Interface/FrameXML/SecureTemplates.lua"]:625: in function `SecureActionButton_OnClick'
[string "@Interface/FrameXML/MultiActionBars.lua"]:14: in function `MultiActionButtonDown'
[string "MULTIACTIONBAR4BUTTON3"]:2: in function <[string "MULTIACTIONBAR4BUTTON3"]:1>

Locals: 

Try

/run for i=0,4 do for x=1,C_Container.GetContainerNumSlots(i) do y=C_Container.GetContainerItemLink(i,x) if y then if GetItemInfo(y)=="Minor Healthstone" then C_Container.PickupContainerItem(i,x) DropItemOnUnit("target") break end end end end
/click TradeFrameTradeButton
1 Like

Thank you very much.

I was not able to get the last part /click TradeFrameTradeButton into the macro because it’s over 255 char count but I’m grateful for whatever I can get.

THANKS!