Food eating macro lol?

I mean if I have both in my bags at the same time, will it use the conjured Mage food first, er?

/run local a,b,c,d,e,f=“Conjured Mana “,“Bun”,“Pudding”,“Seasoned Loins”,“food” f=GetMacroBody(e)EditMacro(e,e,nil,strsub(f,1,strfind(f,”;\n”))…"\n/use "…(GetItemCount(a…b)>0 and a…b or GetItemCount(a…c)>0 and a…c or d));
/use Seasoned Loins

This will use either Conjured Mana Buns or Conjured Mana Pudding if you have them. Otherwise will use Seasoned Loins. Edit as needed.

Macro name must be “food”

2 Likes

@Wog
Tried it, but it’s not working.

You definitely understand what I’m trying to do, which is awesome though!

Thoughts?

@Elvenbane
Here’s exactly what’s in my bags, and what I’m trying to do.

I always keep “Zandalari Kingsteak” in my bags, “BUT” if I have “Conjured Mana Bun” in my bags as well, I would like to have it default switch priority to eating those first when I press my keybind - is this possible, er nah lol…? (Not a big deal whatsoever if it’s not able to be done)

Thanks a lot Good Sir!

Oh. I used blockquote and the forum replaced the two periods “…” with a weird character for some reason. Copy/paste this and it should work.

/run local a,b,c,d,e,f="Conjured Mana ","Bun","Strudel","Seasoned Loins","food" f=GetMacroBody(e)EditMacro(e,e,nil,strsub(f,1,strfind(f,";\n")).."\n/use "..(GetItemCount(a..b)>0 and a..b or GetItemCount(a..c)>0 and a..c or d));
/use Seasoned Loins

Make sure macro name is “food”

2 Likes

Still no luck unfortunately. I subbed in what I actually use in my bags for food, for your “Seasoned Loins” item, which is: “Zandalari Kingsteak,” but it would not fit at the very end of the macro - not enough room apparently, ugh.

Anyways, don’t know what else to do to get this to work lol?!

If you have any ideas, please post them, as I would love to get this to work already!

Thanks again.

1 Like

This will only check for Conjured Mana Buns but fits in the character limit with ur food’s name.

/run local a,b,c,f="Conjured Mana Buns","Zandalari Kingsteak","food" f=GetMacroBody(c)EditMacro(c,c,nil,strsub(f,1,strfind(f,";\n")).."\n/use "..(GetItemCount(a)>0 and a or b));
/use Zandalari Kingsteak
3 Likes

Found this thread when attempting to once again find a replacement for the Buffet/MuchMoreMuch addons, and was able to get your macro working - so thanks! I also had a food with a longer name (Stormsong Sourdough), but was able to fit all the characters into the original version of your macro by changing the macro name to just “f”.

While I like the flavor that all the different foods add to WoW, it would be cool if they implemented some native button(s) that just consumed the best food, drink, buff food, etc. in your bag. And/or raise the macro character limit. :slightly_smiling_face:

1 Like

I updated this a bit for TBC since Conjured Manna Biscuits count as both food and drink.
since there is a limit of 255 characters I had to use 2 macros and have it click different buttons.
Macro 1 - named “EAT”

/run local a,b,c,d,e,f="Conjured Manna Biscuit","EAT","MultiBarRightButton","11","12" f=GetMacroBody(b)EditMacro(b,b,nil,strsub(f,1,strfind(f,";\n")).."\n/click "..(GetItemCount(a)>0 and c..d or c..e));
/click MultiBarRightButton11

The buttons this clicks in Key Bindings as Right Action Button 11 and 12. (in ElvUI this is Bar 3)
If you have a Conjured manna Biscuit it will click 11, if not it will click 12.
Then to eat and drink, make a separate macro and add the following to it (you can name this whatever you want)

/click MultiBarRightButton9
/click MultiBarRightButton10

Now, all you need to do is put the Conjured Manna Biscuits on button 11, the second macro to button 12, and whatever food and water items you want to buttons 9 and 10.

You really should start a new thread rather than necro a years-old post, but I recognize that you only have 5 posts under your belt and maybe haven’t read the forum guidelines.

This isn’t a snotty rule. The game, it’s interface programming, and other factors change over time and it’s not the simplest thing to sort out when a solution doesn’t work because it’s wrong and when it doesn’t work because it’s been deprecated.

That said, you have a couple of . . . I won’t call them errors . . . but inefficiencies in your code that made it longer than it needed to be.

  1. GetItemCount works on both item name and item ID. The item ID for that particular thing is 34062. Since you only reference it one time, using that as a literal rather than a variable saves quite a few characters.
  2. You use “EAT” twice. EditMacro leaves the macro name unchanged if you make the input parameter nil) so you don’t need the second appearance of that in the parameter list. The way you have it set up, you can’t take advantage of the declaration line to assign the function value because the input variable (holding “EAT”) is declared in the same line. Making that a literal, even though that nil takes up three characters, saves a bit of space.
  3. Breaking the line up that has the replaced “click” in it the way you did, you end up having to have two copies of “MultiBarRightButton”. Add to that the fact that you didn’t include the first digit of the number portion (it’s the same for both buttons) and you end up with a LOT of extra characters you don’t need.
  4. The semi-colon is not needed in Lua so I took it out of both the Lua and the find parameter. That whole bit of code is a single “line” terminated with \n and the find function will return the value of the first hit it gets so it’ll work like that.

Long story short, that works out to this:

/run local f=GetMacroBody("EAT")EditMacro("EAT",nil,nil,strsub(f,1,strfind(f,"\n")).."\n/click MultiBarRightButton1"..(GetItemCount(34062)>0 and '1' or '2'))
/click MultiBarRightButton11
/click MultiBarRightButton9
/click MultiBarRightButton10

244 characters, all in one macro.

Good job otherwise. I like to see people stretching what can be done within the API. Keep it up!

And for future squeezies, the quotes around '1' or '2' aren’t required as you can concatenate numbers.

Doesn’t everyone use Macro Tool Kit now, the shiny new Macro app? Feels like someone at Blizzard coded it. Seems perfect IMO. Has everything, very few flaws. Just extend your macro length and your food eating macro comes right back.

Hotkey function is nice to save room on bars too.

I wasn’t entirely sure about that and as I’ve deleted my characters prior to my current sub running out, I couldn’t test it.

Even better, though. Gets it down to 240 characters.

I figured the GWOT might be a bit much, but explaining the HOW of it felt . . . educational.

Good catch on that.

I’ve had enough “mystery” errors out of MTK that I don’t recommend it. Nothing more frustating than fighting a difficult bit of macro magic only to find out that what you’re doing works in the vanilla macro environment, but not in MTK.

If my macro is genuinely too long, I just macro-chain to a second one.

If it’s too long because there’s Lua in it making it too long, I move the Lua into an addon (everyone should have a utility addon for this) and make it a slash command in there and then put the slash command in the macro.

My hunter has chains of macros that are 4 long tied to every targetable ability to handle contextually appropriate pet management, target acquisition, misdirection, and explicit execution of the pets’ basic attacks.

1 Like

No, you’re right. I agree. You can’t edit long macros.
But even the api changes. Nothing is safe. You just try your best to make an environment that won’t get messed up.

A food eating macro or a macro that eats food?

Teacher: Little johnny where is your homework?
Johnny: Ummmm, my macro ate it? :grin:

Here is what I use and it fits into the games 255 character macro limit. Just change the food to the one you use.

/run local a,b,c,f="Conjured Mana Bun","Stygian Stew","food" f=GetMacroBody(c)EditMacro(c,c,nil,strsub(f,1,strfind(f,";\n")).."\n/use "..(GetItemCount(a)>0 and a or b));

Sorry to necro the old post. I kept seeing this post when I was looking for ideas for this so I figured I would add my input for the next person.

That being said, when I tested your version, it results in my character eating a mana biscuit and drinking water, wasting the water. In other words, with Mana biscuit it clicks 10 and 11, and without it it clicks 9 and 10. However, I do love how you shortened it. I am by no means an expert on the API but I am learning little by little lol.

Could you give me a “map” to work with?

What consumable is on each of these:

MultiBaRightButton9
MultiBaRightButton10
MultiBaRightButton11
MultiBaRightButton12

I suspect the macro is working as intended, but the button assignments might be incorrect.

MultiBarRightButton9 - Food
MultiBarRightButton10 - Water
MultiBarRightButton11 - Mana Biscuit
MultiBarRightButton12 - my macro for clicking 9 and 10

Search Curse for “DrinkBot,” which is an addon I made that does basically exactly this. It’s built for mana restoration drinks, but prioritizes mage food over what you have in your bags.

Okay, I think i see the problem.

It works like this:

If you have Conjured Manna Biscuit(s) (item number 34062), set the first click line to read as follows:
/click MultiBarRightButton12
Otherwise set it as follows:
/click MultiBarRightButton11
Click the three buttons (as modified) in sequence.

That means that your Conjured Manna Biscuit(s) need to be on …Button12, your water needs to be on …Button11, your food needs to be on …Button10, …Button9 can be removed from the macro (and could be used as the one where your macro is).

That would result in this:

/run local f=GetMacroBody("EAT")EditMacro("EAT",nil,nil,strsub(f,1,strfind(f,"\n")).."\n/click MultiBarRightButton1"..(GetItemCount(34062)>0 and 1 or 2))
/click MultiBarRightButton11
/click MultiBarRightButton10

With the macro sitting whereever you want OTHER than …Button10-12.

I think that’ll fix it. Let me know.