ForageAA.mac

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

bror
decaying skeleton
decaying skeleton
Posts: 5
Joined: Sun Nov 13, 2005 4:48 am

ForageAA.mac

Post by bror » Mon Feb 06, 2006 12:04 am

This mac does the following:
*If you were sitting at the time of forage, this will stand you to do the foraging and then sit you down again.

*If you were attacking at the time of forage, this will stop attack, forage and then resume attack.

*This allows you (like yafm.mac) to set how many of an item you want to keep, 0 destroys the item, 10 is the default save, 20 will save 20, 30 will save 30, etc. Simply set the value in forageaa.ini.

*If an item is not found in the .ini, it will automatically be added (like yafm.mac and mq2autoforage).

*If there is no .ini, it will automatically be created.

*This prints out a short synopsis of your forage deeds. Tells you how many forages you've done, how many times you've got food/water, how many inedibles, how many fishing grubs, and how many fails.

*Does a simple popup message if you get a Double Forage thanks to the Nature's Bounty AA.

*This also tells you how many of that particular item you currently have in inventory already.

*WARNING!!!! - DO NOT SET DefaultSave to 0!!! You might accidentally destroy something in your inventory or gear with this setting!!!!! You have been warned!!!!

So, after all that, here it is:

Code: Select all

| ForageAA.mac
|
| This macro is adapted from yafm and mq2autoforage plugin
| since neither of those plugins takes into account if you
| have Nature's Bounty AA's and manage to forage more than
| one item. This also prints out a little chart giving you
| forage statistics. I liked the /echo functionality of 
| mq2autoforage, and the ability of yafm.mac to say how
| many items you want to keep. So, I combined the two into
| one.
|
|
| *WARNING* - DO NOT SET DefaultSave to 0. If you accidentally
|   click on something in your inventory, you could destroy
|   it if MaxSave is set to 0.
|
| Ini File: forageaa.ini
|
| 0 = destroy
| X = keep X of that item
|
|
| New foraged items are kept and added to the ini automatically
|
| yafm.mac   author = bootyjuice
|            moded  = mdar
|            moded  = Redbot
|            moded  = bror


#event YouDied "You have been slain by#*#"
#event Bounty  "Your forage mastery has enabled you to find something else!"
#event SkillUp "You have become better at Foraging (#*#)"
#event Fail    "You failed to locate any food nearby."
#event Food    "You have scrounged up some food."
#event Water   "You have scrounged up some water."
#event Stuff   "You have scrounged up something that doesn't look edible."
#event Grubs   "You have scrounged up some fishing grubs."
#event Camp    "It will take you about #*# seconds to prepare your camp."

sub main
   /declare DefaultSave      outer
   /declare NotFound     int outer -1

   /declare iBounty int outer 0
   /declare iFail   int outer 0
   /declare iFood   int outer 0
   /declare iSkill  int outer 0
   /declare iWater  int outer 0
   /declare iGrubs  int outer 0
   /declare iStuff  int outer 0
   /declare iAtk    int outer 0
   /declare iSit    int outer 0

   /varset DefaultSave ${Ini[forageaa.ini,Default,Save,${NotFound}]} 
    /if (${DefaultSave}==${NotFound}) { 
        /ini "forageaa.ini" "Default" "Save" "20" 
        /varset DefaultSave 20 
    } 

   /cleanup

   |Verify that we are able to forage
   /if (${Me.Skill[forage]}==0) {
      /echo You cannot forage! Sorry...
      /goto :Exit
   }

   :Forage

   |If we're able to forage, let's get with it.
   /if (${Me.AbilityReady[Forage]}) {
       |Stand Up if not already
       /if (${Me.State.NotEqual[Stand]}) {
           /varset iSit 1
           /stand
           /delay 5
       }

       |If attack is on, stop attacking
       /if (${Me.Combat}==TRUE) {
          /echo Stopping Attack to Forage...
          /varset iAtk 1
          /attack
          /delay 5
       }

       /doability Forage
   }

   /doevents

   |If we foraged something, deal with it
   /if (${Cursor.ID}) {
       /call HandleItem
   }
   
   |If we were sitting, resit
   /if (${iSit}==1) {
      /delay 1s
      /sit
      /varset iSit 0
      /delay 5
   }

   |If we were attacking, resume
   /if (${iAtk}==1) {
      /attack
      /varset iAtk 0
      /delay 3
   }

   /goto :Forage

:Exit
/return

sub HandleItem

   /declare ItemSetting int local
   /declare ItemsHave int local 

   :LootIt

   |Look up the item in forageaa.ini
   /varset ItemSetting ${Ini[forageaa.ini,ForageList,${Cursor.Name},${NotFound}]}
   /delay 5

   |If the item is not on the list, add it
   /if (${ItemSetting}==${NotFound}) {
       /ini "forageaa.ini" "ForageList" "${Cursor.Name}" "${DefaultSave}"
       /echo Item not found, Adding ${Cursor.Name} to forageaa.ini
       /varset ItemSetting ${DefaultSave}
   }

   /varset ItemsHave ${FindItemCount=${Cursor.Name}} 

   |If we're keeping this, put it in Inventory
   |Otherwise destroy
   /if (${ItemSetting}>${ItemsHave}) {
       /echo Keeping: ${Cursor.Name}
       /echo Currently Have ${ItemsHave} of ${Cursor.Name}
       /autoinventory
   } else {
       /echo Destroying: ${Cursor.Name}
       /destroy
   }


   /delay 5
   /if (${Cursor.ID}) {
       /goto :LootIt
   }

   /call ForageStats

/return

Sub ForageStats
   /declare iForage int local 0
   /declare iBads   int local 0
   /declare iSust   int local 0

   /varcalc iForage ${iFood}+${iWater}+${iGrubs}+${iStuff}+${iFail}
   /varcalc iBads   ${iFail}+${iGrubs}
   /varcalc iSust   ${iWater}+${iFood}

   /echo --------------------------------------------------------------------
   /echo * Total Forages: ${iForage}          
   /echo * Food/Water   : ${iSust}            
   /echo * Inedibles    : ${iStuff}           
   /echo * Grubs, Fails : ${iBads}            
   /echo * Skillups     : ${iSkill}           
   /echo * Double Forage: ${iBounty}          
   /echo * Current Skill: ${Me.Skill[Forage]} 
   /echo --------------------------------------------------------------------
/return


Sub Event_YouDied
   /echo You Died at ${Time}, ending macro.
   /quit
   /end
/return

Sub Event_Bounty
   /popup Woot, Double Forage!
   /varcalc iBounty ${iBounty}+1
/return

Sub Event_SkillUp
   /echo Your Skill has Increased!
   /echo Foraging = ${Me.Skill[Forage]}
   /echo iSkill ${iSkill}+1
/return

Sub Event_Water
   /varcalc iWater ${iWater}+1
/return

Sub Event_Food
   /varcal iFood ${iFood}+1
/return

Sub Event_Stuff
   /varcalc iStuff ${iStuff}+1
/return

Sub Event_Fail
   /varcalc iFail ${iFail}+1
/return

Sub Event_Grubs
   /varcalc iGrubs ${iGrubs}+1
/return

Sub Event_Camp
   /endmac
/return
Last edited by bror on Mon Feb 06, 2006 2:39 pm, edited 2 times in total.

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 » Mon Feb 06, 2006 8:20 am

Out of curiousity, why are you using 10 as the default save? I could understand for non-stackable items, but keeping 10 just seems like wasting half your inventory real estate.
[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]

bror
decaying skeleton
decaying skeleton
Posts: 5
Joined: Sun Nov 13, 2005 4:48 am

Post by bror » Mon Feb 06, 2006 8:58 am

When I was debugging the macro, I wanted a low value so I could make sure the logic worked on the throwaway part. I simply forgot to change it back to a full stack, it's corrected above now.

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 » Mon Feb 06, 2006 9:09 am

That's cool, just struck me as an odd number.
[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]

bror
decaying skeleton
decaying skeleton
Posts: 5
Joined: Sun Nov 13, 2005 4:48 am

Post by bror » Mon Feb 06, 2006 2:42 pm

Fixed a problem where this was writing NULL into the .ini for the save value for new items, has been corrected in the above code.

If you already made this macro, change:

Code: Select all

|If the item is not on the list, add it 
   /if (${ItemSetting}==${NotFound}) { 
       /ini "forageaa.ini" "ForageList" "${Cursor.Name}" "${Default[color=red]Max[/color]Save}" 
       /echo Item not found, Adding ${Cursor.Name} to forageaa.ini 
       /varset ItemSetting ${DefaultSave} 
   } 
to:

Code: Select all

|If the item is not on the list, add it 
   /if (${ItemSetting}==${NotFound}) { 
       /ini "forageaa.ini" "ForageList" "${Cursor.Name}" "${DefaultSave}" 
       /echo Item not found, Adding ${Cursor.Name} to forageaa.ini 
       /varset ItemSetting ${DefaultSave} 
   } 

Smyrk
a ghoul
a ghoul
Posts: 86
Joined: Mon Jun 13, 2005 3:40 pm

Post by Smyrk » Tue Mar 14, 2006 12:14 pm

I have found that in order for this to actually count the items and determine if it should keep or destroy a forage this:

Code: Select all

   /varset ItemsHave [color=red]${FindItemCount=${Cursor.Name}}[/color]

   |If we're keeping this, put it in Inventory
   |Otherwise destroy
Needs to be changed to this:

Code: Select all

   /varset ItemsHave [color=cyan]${FindItemCount[=${Cursor.Name}]}[/color]

   |If we're keeping this, put it in Inventory
   |Otherwise destroy

MareDK
a snow griffon
a snow griffon
Posts: 329
Joined: Mon Jan 31, 2005 12:01 pm

Post by MareDK » Sat Apr 22, 2006 12:17 am

I made a few changes to this so that it works better
  • Added Starting skill
    Calculate Gained skills out from starting skill and current skill instead of event
    Fixed Failure counting
    Fixed Normal counting
    *NOT TESTED AA foraging yet

Code: Select all

| ForageAA.mac
|
| This macro is adapted from yafm and mq2autoforage plugin
| since neither of those plugins takes into account if you
| have Nature's Bounty AA's and manage to forage more than
| one item. This also prints out a little chart giving you
| forage statistics. I liked the /echo functionality of
| mq2autoforage, and the ability of yafm.mac to say how
| many items you want to keep. So, I combined the two into
| one.
|
|
| *WARNING* - DO NOT SET DefaultSave to 0. If you accidentally
|   click on something in your inventory, you could destroy
|   it if MaxSave is set to 0.
|
| Ini File: forageaa.ini
|
| 0 = destroy
| X = keep X of that item
|
|
| New foraged items are kept and added to the ini automatically
|
| yafm.mac   author = bootyjuice
|            moded  = mdar
|            moded  = Redbot
|            moded  = bror


#event YouDied "You have been slain by#*#"
#event Bounty  "Your forage mastery has enabled you to find something else!"
#event SkillUp "You have become better at Foraging (#*#)"
#event Fail    "You fail to locate any food nearby."
#event Food    "You have scrounged up some food."
#event Water   "You have scrounged up some water."
#event Stuff   "You have scrounged up something that doesn't look edible."
#event Grubs   "You have scrounged up some fishing grubs."
#event Camp    "It will take you about #*# seconds to prepare your camp."

sub main
   /declare DefaultSave      outer
   /declare NotFound     int outer -1

   /declare iBounty      int outer 0
   /declare iFail        int outer 0
   /declare iFood        int outer 0
   /declare iSkill       int outer 0
   /declare iWater       int outer 0
   /declare iGrubs       int outer 0
   /declare iStuff       int outer 0
   /declare iAtk         int outer 0
   /declare iSit         int outer 0
   /declare StartSkill   int outer 0
   /declare CurrentSkill int outer 0
   /declare iForage      int outer 0
   /declare iBads        int outer 0
   /declare iSust        int outer 0
   /declare iStuffPer    int outer 0
   /declare iBadsPer     int outer 0
   /declare iSustPer     int outer 0
   
   /varset StartSkill ${Me.Skill[Forage]}

   /varset DefaultSave ${Ini[forageaa.ini,Default,Save,${NotFound}]}
    /if (${DefaultSave}==${NotFound}) {
        /ini "forageaa.ini" "Default" "Save" "20"
        /varset DefaultSave 20
    }

   /cleanup

   |Verify that we are able to forage
   /if (${Me.Skill[forage]}==0) {
      /echo You cannot forage! Sorry...
      /goto :Exit
   }

   :Forage
   /doevents flush

   |If we're able to forage, let's get with it.
   /if (${Me.AbilityReady[Forage]}) {
       |Stand Up if not already
       /if (${Me.State.NotEqual[Stand]}) {
           /varset iSit 1
           /stand
           /delay 5
       }

       |If attack is on, stop attacking
       /if (${Me.Combat}==TRUE) {
          /echo Stopping Attack to Forage...
          /varset iAtk 1
          /attack
          /delay 5
       }

       /doability Forage
       /delay 1s
       /doevents
       
   |If we foraged something, deal with it
   /if (${Cursor.ID}) {
       /call HandleItem
       
   }

       /call ForageStats
       }

   
   

   
   
   |If we were sitting, resit
   /if (${iSit}==1) {
      /delay 1s
      /sit
      /varset iSit 0
      /delay 5
   }

   |If we were attacking, resume
   /if (${iAtk}==1) {
      /attack
      /varset iAtk 0
      /delay 3
   }

   /goto :Forage

:Exit
/return

sub HandleItem

   /declare ItemSetting int local
   /declare ItemsHave int local

   :LootIt

   |Look up the item in forageaa.ini
   /varset ItemSetting ${Ini[forageaa.ini,ForageList,${Cursor.Name},${NotFound}]}
   /delay 5

   |If the item is not on the list, add it
   /if (${ItemSetting}==${NotFound}) {
       /ini "forageaa.ini" "ForageList" "${Cursor.Name}" "${DefaultSave}"
       /echo Item not found, Adding ${Cursor.Name} to forageaa.ini
       /varset ItemSetting ${DefaultSave}
   }

   /varset ItemsHave ${FindItemCount[=${Cursor.Name}]}

   |If we're keeping this, put it in Inventory
   |Otherwise destroy
   /if (${ItemSetting}>${ItemsHave}) {
       /echo Keeping: ${Cursor.Name}
       /echo Currently Have ${ItemsHave} of ${Cursor.Name}
       /autoinventory
   } else {
       /echo Destroying: ${Cursor.Name}
       /destroy
   }


   /delay 5
   /if (${Cursor.ID}) {
       /goto :LootIt
   }



/return

Sub ForageStats


   /varcalc iForage ${iFood}+${iWater}+${iGrubs}+${iStuff}+${iFail}
   /varcalc iBads   ${iFail}+${iGrubs}
   /varcalc iSust   ${iWater}+${iFood}
   /varcalc iSkill ${Me.Skill[Forage]}-${StartSkill}

   /echo --------------------------------------------------------------------
   /echo * Total Forages : ${iForage}    
   /echo * Food/Water    : ${iSust}         
   /echo * Inedibles     : ${iStuff}      
   /echo * Grubs, Fails  : ${iBads}       
   /echo * Skillups      : ${iSkill}           
   /echo * Double Forage : ${iBounty}  
   /echo * Starting Skill: ${StartSkill}       
   /echo * Current Skill : ${Me.Skill[Forage]}  
   /echo --------------------------------------------------------------------
/return


Sub Event_YouDied
   /echo You Died at ${Time}, ending macro.
   /quit
   /end
/return

Sub Event_Bounty
   /popup Woot, Double Forage!
   /varcalc iBounty ${iBounty}+1
/return

Sub Event_SkillUp
   /echo Your Skill has Increased!
   /echo Foraging = ${Me.Skill[Forage]}
   
/return

Sub Event_Water
   /varcalc iWater ${iWater}+1

/return

Sub Event_Food
   /varcal iFood ${iFood}+1
/return

Sub Event_Stuff
   /varcalc iStuff ${iStuff}+1

/return

Sub Event_Fail
   /varcalc iFail ${iFail}+1

/return

Sub Event_Grubs
   /varcalc iGrubs ${iGrubs}+1

/return

Sub Event_Camp
   /endmac
/return 
 

Eandiien
a ghoul
a ghoul
Posts: 80
Joined: Mon Jan 23, 2006 11:31 am
Location: lost
Contact:

timeing

Post by Eandiien » Sun Apr 23, 2006 1:23 am

something is wrong with the timeing recieving a message before each forage stating not ready to forageyet or something close to that then it immeaditly goes to forage seconds later. any help on this one . this is new as of the patch this last wednesday

User avatar
Jeepster
a lesser mummy
a lesser mummy
Posts: 45
Joined: Thu Aug 12, 2004 1:05 pm
Location: Michigan

Post by Jeepster » Sun Apr 23, 2006 3:22 am

It's not the .mac that is causing your troubles, I have been using forage macs for 2 years now and I get the same message every now and then, same thing happens when you try to cast a spell and it doesn't fire or when you can't get your spell gems to show spells ready to go.

It's a timesync problem with your computer clock being off compared to the EQ clock,, I usually camp out and shut tdown the computer for a few minutes then do a restart , That should fix your problem. I am using this mac atm running 24 / 7 and have had no troubles since the patch.

Eandiien
a ghoul
a ghoul
Posts: 80
Joined: Mon Jan 23, 2006 11:31 am
Location: lost
Contact:

Post by Eandiien » Sun Apr 23, 2006 9:25 am

thanks

Eandiien
a ghoul
a ghoul
Posts: 80
Joined: Mon Jan 23, 2006 11:31 am
Location: lost
Contact:

probably should have posted here

Post by Eandiien » Thu Jun 01, 2006 1:12 pm

do a search for forageaa.mac and you will come up with one that I have added a few things to ie GM check and a trainer for tracking. not that we need it but hey why not get skills maxed out. any how thats that.

WizeOne
a hill giant
a hill giant
Posts: 207
Joined: Tue Jul 12, 2005 12:36 pm

Post by WizeOne » Mon Oct 16, 2006 4:45 am

works good, though the line

Code: Select all

 echo Currently Have ${ItemsHave} of ${Cursor.Name} 
always shows 1 less then you really have

Eandiien
a ghoul
a ghoul
Posts: 80
Joined: Mon Jan 23, 2006 11:31 am
Location: lost
Contact:

so i have notied

Post by Eandiien » Mon Oct 16, 2006 5:04 pm

i have noticed thsi and figure at least it stops when its soposed to the first one i pulled from this site had an error and didnt stop properly on certin itams. any hwo if any one has any ideas let me know.
Truely lost and hopeless but dieing to learn more and improve NUB

User avatar
wanttocheat
decaying skeleton
decaying skeleton
Posts: 5
Joined: Fri Apr 06, 2007 1:01 am

a fix for this

Post by wanttocheat » Tue Apr 10, 2007 5:55 pm

One other fix I needed to make to this...

Code: Select all

#event SkillUp "You have become better at [color=darkred]Foraging [/color]
should actually be

Code: Select all

#event SkillUp "You have become better at [color=red]Forage[/color]
or else it doesn't count skillups correctly.

FrankJScott
naggy
naggy
Posts: 2128
Joined: Sun Feb 19, 2023 7:11 am

Top Rated Product Tips

Post by FrankJScott » Fri Aug 18, 2023 7:22 pm

Why don't you Google it! before you post