Feedme.inc v2.3

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!

Moderator: MacroQuest Developers

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Feedme.inc v2.3

Post by A_Druid_00 » Thu Nov 04, 2004 5:18 pm

5/9 Put up v2.3 fix by onetimehero. No one says it's broken, so I guess it's good!
12/3 v2.2 Changed the logic around so that it now puts the food down in the bag which it retrieved it from, closing the bag as a result. If there is no mypack, it just right clicks on the food in it's current inventory slot.
11/24 Added a FeedMeDeclares Sub which defines an alias and toggle value to turn feedme on and off while running your macro. This way you won't have to end your macro when you run out of force feeding food to prevent the NULL spam. You now need to add a

Code: Select all

/call FeedMeDeclares 
in the declares section of the calling macro in order to get things running.
11/24 Changed the drink threshold back to 5,000, forgot to change it back after bug testing
11/23 Feedme is now ini driven!! Sample ini is posted below, feel free to add any junk food I don't happen to have.

Figured I'd post a .inc for this, since it really isn't a spectacular .mac all by itself. It basically eats the food and drink you specify when your hunger/thirst falls below the threshold of 5000. You can define the food to eat and drink to drink in an ini file named feedme.ini.

If any of you .inc gurus see an area that can be improved, feel free to point it out.

Code: Select all

|Feedme.inc v2.3 compliments of onetimehero
#Event SetFeedMe "[MQ2] SetFeedMe#*#" 

Sub FeedMeDeclares 
/declare DoFeedMe int outer 1 

/squelch /alias /feedme     /echo SetFeedMe 
/return 

Sub FeedMe 
/if (${Me.Casting.ID}) /return 
/if (${DoFeedMe}==1) { 
  /if (${Me.Hunger}<=5000) /call Consume Food 
  /if (${Me.Thirst}<=5000) /call Consume Drink 
} 
/return 

Sub Consume(string what) 
/declare mypack         string local 
/declare myslot         string local 
/declare i              int    local 
/declare foodcount      int    local 
/declare food       string local 

/autoinventory 
/if (${Cursor.ID}) /return 
/varset foodcount ${Ini[feedme.ini,${what}].Count[${what}]} 
/for i 1 to ${foodcount} 
/varset food ${Ini[feedme.ini,${what},${what}${i}]} 
/if (${FindItemCount[${food}]}>0) { 
  /varset mypack ${FindItem[${food}].InvSlot.Pack} 
  /varset myslot ${FindItem[${food}].InvSlot} 
  /if (${mypack}) { 
    /if (!${Window[${InvSlot[${mypack}].Name}].Open}) /nomodkey /itemnotify ${mypack} rightmouseup 
    :WaitForBagOpen 
    /nomodkey /ctrl /itemnotify ${myslot} leftmouseup 
    /if (!${Cursor.ID}) /goto :WaitForBagOpen 
    /nomodkey /itemnotify ${mypack} leftmouseup 
    /nomodkey /itemnotify ${mypack} rightmouseup 
    /nomodkey /itemnotify ${mypack} leftmouseup 
  } else { 
    /nomodkey /itemnotify ${myslot} rightmouseup 
  } 
} else { 
  /next i 
} 
/return 

Sub Event_SetFeedMe(string Line) 
/if (!${Line.Arg[3].Length}) { 
  /if (${DoFeedMe}==1) { 
    /varset DoFeedMe 0 
    /echo Auto Force Feeding is now OFF 
  } else { 
    /varset DoFeedMe 1 
    /echo Auto Force Feeding is now ON 
  } 
} 
/if (${Line.Arg[3].Equal[ON]} || ${Line.Arg[3].Equal[TRUE]} || ${Line.Arg[3].Equal[1]}) { 
  /varset DoFeedMe 1 
  /echo Auto Force Feeding is now ON 
} 
/if (${Line.Arg[3].Equal[OFF]} || ${Line.Arg[3].Equal[FALSE]} || ${Line.Arg[3].Equal[0]}) { 
  /varset DoFeedMe 0 
  /echo Auto Force Feeding is now OFF 
} 
/return 
Just to explain my reasoning for using returns after the Cursor.ID check: I don't think eating is a very huge priority in the grand sceme of things, so I let it /return in order to give control back to the calling macro until the next time this inc is called. This way, if something important needs to be adressed by the parent macro, this sub won't hold it up much.
Last edited by A_Druid_00 on Mon May 09, 2005 1:56 pm, edited 6 times in total.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Tue Nov 23, 2004 7:23 pm

Here's the feedme.ini I currently have setup, feel free to post any other junk foods I may have missed

feedme.ini

Code: Select all

[Food]
Food1=Summoned: Black Bread
Food2=Arctic King Crab
Food3=Arctic Mussels
Food4=Arctic Scallop
Food5=Basilisk Eggs
Food6=Berries
Food7=Brasha Berries
Food8=Cactus Pulp
Food9=Chameleon Rat
Food10=Cobalt Rock Crab
Food11=Cockatrice Egg
Food12=Emerald Orange
Food13=Frontier Stink Beetles
Food14=Frost Turnip
Food15=Fruit
Food16=Ginseng
Food17=Green Radish
Food18=Griffon Eggs
Food19=Habanero Pepper
Food20=Handful of Tea Twigs and Leaves
Food21=Hermit Crab
Food22=Honey Berry
Food23=Lichen Roots
Food24=Mint
Food25=Moldy Tea Leaf
Food26=Mud Crabs
Food27=Mushroom
Food28=Nifilik Egg
Food29=Phoenix Egg
Food30=Rabbit Meat
Food31=Ro Dates
Food32=Rockweed Bulb
Food33=Roots
Food34=Ruhiri Berries
Food35=Rujarkian Potato
Food36=Spikerattle Root
Food37=Sylvan Berries
Food38=Twisted Tuber
Food39=Vegetables
Food40=Vein Worm
Food41=Wild Cabbage
Food42=1 lb. Cragbeast Meat
Food43=1 lb. Hynid Meat
Food44=2 lb. Cragbeast Meat
Food45=2 lb. Hynid Meat
Food46=3 lb. Cragbeast Meat
Food47=3 lb. Hynid Meat
Food48=4 lb. Cragbeast Meat
Food49=4 lb. Hynid Meat
Food50=5 lb. Cragbeast Meat
Food51=5 lb. Hynid Meat
Food52=6 lb. Cragbeast Meat
Food53=6 lb. Hynid Meat
Food54=7 lb. Cragbeast Meat
Food55=7 lb. Hynid Meat
Food56=8 lb. Cragbeast Meat
Food57=8 lb. Hynid Meat
Food58=9 lb. Cragbeast Meat
Food59=9 lb. Hynid Meat
Food60=10 lb. Cragbeast Meat
Food61=10 lb. Hynid Meat
Food62=11 lb. Cragbeast Meat
Food63=11 lb. Hynid Meat
Food64=12 lb. Cragbeast Meat
Food65=12 lb. Hynid Meat
Food66=13 lb. Cragbeast Meat
Food67=14 lb. Cragbeast Meat
Food68=15 lb. Cragbeast Meat
Food69=15 lb. Hynid Meat
Food70=Dragon Egg
Food71=Drake Egg
Food72=Wurm Egg
Food73=Rye of Eternity
[Drink]
Drink1=Brackish Water
Drink2=Glob of Slush Water
Drink3=Pod of Water
Drink4=Water Flask
Drink5=Water of Eternity
Last edited by A_Druid_00 on Thu Nov 25, 2004 8:37 am, edited 1 time in total.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

Neolesh
a hill giant
a hill giant
Posts: 231
Joined: Mon Aug 23, 2004 11:15 am

Post by Neolesh » Tue Nov 23, 2004 10:46 pm

Only thing I see right away I would change is the variable "i" because it is used in spell_routines.inc which I use in most of my macro's.

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Tue Nov 23, 2004 11:39 pm

I am pretty sure that looks like it is set local to the sub, so unless spell_routines puts it out as a outer or global it should be fine.

Or I could be crack smoker.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

Goofmester1
a hill giant
a hill giant
Posts: 241
Joined: Thu Nov 06, 2003 4:26 am

Post by Goofmester1 » Wed Nov 24, 2004 12:33 am

Both includes have the i declared local so the only chance of them causing problems with each other is if the value of i gets set by one and not cleared before the other one wants to use it. may want to set a start value for i when you declare it or before you first use it would be all that is needed in both includes.

Neolesh
a hill giant
a hill giant
Posts: 231
Joined: Mon Aug 23, 2004 11:15 am

Post by Neolesh » Wed Nov 24, 2004 2:38 am

I always end up with problems in my macs if I use "i" but it's probably because I'm declaring it outer... never thought about it hehe always just changed it to "ii" or "a"

storekeeper
orc pawn
orc pawn
Posts: 28
Joined: Sat Jun 26, 2004 4:59 pm

Post by storekeeper » Sat Dec 04, 2004 7:22 pm

All I have to do is add the /call FeedmeDeclares line and make an inc file with the stuff noted? Cause it doesn't seem to be eatting anything. I can turn it on and off. About only thing I have seen it was responding at all.

Some of those varibles I have to set or what?

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Sun Dec 05, 2004 1:12 am

storekeeper wrote:All I have to do is add the /call FeedmeDeclares line and make an inc file with the stuff noted? Cause it doesn't seem to be eatting anything. I can turn it on and off. About only thing I have seen it was responding at all.

Some of those varibles I have to set or what?
You /call feedme declares before your main loop to set the variables. you /call feedme in the main loop to actually eat the food when you get hungry.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

outlander
a hill giant
a hill giant
Posts: 232
Joined: Mon Feb 14, 2005 11:40 am

Post by outlander » Sun Feb 27, 2005 9:09 am

Hey A_Druid_00 Nice Include, I found Cr4zyb4rd's brute force first, made it into a kluge include, then decided to search one more time and got your include.

Have not tested it yet but it was one of the features I wanted in my new Hunting macro.

Yours is more than I was going to do so great job.

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Sun Feb 27, 2005 9:49 am

Thanks, this was my first real attempt at making anything macro related, and it's still one of my favorites. Between this and buffbeg, at lot of the more tedious things I hated about EQ were eliminated.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Sun Feb 27, 2005 4:44 pm

Code: Select all

drink=Fuzzlecutter Formula 5000
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

notadruid
a ghoul
a ghoul
Posts: 143
Joined: Mon Dec 08, 2003 6:02 pm

Post by notadruid » Sun Feb 27, 2005 6:44 pm

Code: Select all

drink=Bottle of Milk
drink=Milk
I am not a druid.

hendrix04
a lesser mummy
a lesser mummy
Posts: 38
Joined: Tue Jul 13, 2004 5:02 pm

Post by hendrix04 » Sat Mar 26, 2005 10:44 am

this would be an awsome plugin

Twen
orc pawn
orc pawn
Posts: 19
Joined: Fri Dec 10, 2004 1:41 pm

Post by Twen » Thu Apr 28, 2005 10:33 pm

is there a command to tell what your hunger and thirst currently is?and at what value do you auto eat?

Hihi
a lesser mummy
a lesser mummy
Posts: 31
Joined: Wed Mar 30, 2005 3:35 pm

Post by Hihi » Fri Apr 29, 2005 1:22 am

/echo ${Me.Hunger}
/echo ${Me.Thirst}

Is right in the manual >.<


Can't recall offhand what # causes you to auto-eat/drink though.

Edit: Looking at the mac, it seems that 5k is just about the cutoff for auto-eat/drink.