Adv_foraging macro v1.0 beta (Advanced Foraging Macro)

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

Moderator: MacroQuest Developers

jakevsnake
orc pawn
orc pawn
Posts: 16
Joined: Sat Oct 22, 2005 1:10 pm

Adv_foraging macro v1.0 beta (Advanced Foraging Macro)

Post by jakevsnake » Mon May 15, 2006 3:21 am

Ok I wanted to have a foraging macro that worked like the adv_fishing macro so here it is. It has been tested for a limited time but it works. This is meant to do while AFK or at least while not moving items in inventory or looting mobs. This is because you will drop those items that are not in your loot list for that zone. I will try to add code for when you might be sitting or memming spells, but my first attempts didnt seem to work out that well. I would like to thank Panther for his adv_fishing macro for which this is a complete ripoff of :) If you are like me and like to afk forage in zones and dont want anything outside your loot table this is your macro. Suggestions are welcome and feel free to post yer mods of it here.

Code: Select all

|--------------------------------------------------------------------------------- 
| Advanced Foraging Macro 
| adv_foraging.mac 
| Author      : jakevsnake ORIGINAL CODE by PANTHER 
| Version     : v1.0beta 2006-05-15
| Useage      : /macro adv_foraging 
| Description : 
| This macro will forage for you and keep all items in ForagingLoot.ini. 
|--------------------------------------------------------------------------------- 

#turbo 10 

#event ForageMastery "Your forage mastery has enabled you to find something else!" 
 

Sub Main 

   |------------------------------------------------------------ 
   |Should I display foraging stats? (1 for yes, 0 for no) 
   |------------------------------------------------------------ 
   /declare RV_DisplayStats     int outer  1 
   /echo Starting up ${Macro}  
   /declare int_ItemsDropped     int outer  0  
   /declare int_Nothingforaged     int outer  0 
   /declare int_Totalforage     int outer  0 
   |------------------------------------------------------------ 
   |Load in Loot Table. 
   |------------------------------------------------------------ 
   /call ReadINI ForagingLoot.ini "${Zone.Name}" Loot 
   /if (!${Defined[RV_LootArray]}) { 
      /echo No Loot Table Created... Please create one. 
      /endmacro 
   } 

   /autoinventory 

   :Start 
      /call GMCheck 
      /delay 2s 
      /if (${Cursor.ID}) /call Looting 
      /if (${Me.AbilityReady[Forage]}) { 
         /delay 1s 
         /varcalc int_Totalforage ${int_Totalforage}+1 
         /doability Forage 
      } 
      /doevents 
   /goto :Start 
/return 



|-------------------------------------------------------------------------------- 
|SUB: Display foraging stats. 
|-------------------------------------------------------------------------------- 
Sub DisplayStats 

   /declare nArray  int local 
   /echo Total number of forages = ${int_Totalforage} 
   /echo Items foraged so far 
   /echo ------------------- 
   /if (${Defined[RV_LootArray]}) { 
      /for nArray 1 to ${RV_LootArray.Size} 
         /echo ${Int[${RV_LootStats[${nArray}]}]} - ${RV_LootArray[${nArray}]}'s 
      /next nArray 
   } 
   /echo 
   /echo Bad foraging so far 
   /echo ------------------ 
   /echo ${int_ItemsDropped} - Items dropped 
   /echo ${int_Nothingforaged} - Nothing foraged 
 /return 

|-------------------------------------------------------------------------------- 
|SUB: Check for GM's in zone. 
|-------------------------------------------------------------------------------- 
Sub GMCheck 

   /if (${Spawn[gm].ID}) { 
      /beep 
      /beep 
      /beep 
      /echo GM entered the zone! 
      /echo For safty reasons ending the macro... 
      /endmacro 
   } 

/return 

|-------------------------------------------------------------------------------- 
|SUB: Looting based on ForagingLoot.ini. 
|-------------------------------------------------------------------------------- 
Sub Looting 

   /declare LootCheck   int inner  0 

   /for LootCheck 1 to ${RV_LootArray.Size} 
      /if (${Cursor.Name.Find[${RV_LootArray[${LootCheck}]}]}) { 
         /echo Keeping a ${Cursor.Name}... WOOT! 
         /varcalc RV_LootStats[${LootCheck}] ${RV_LootStats[${LootCheck}]}+1 
         /autoinventory 
      } 
   /next LootCheck 

   /if (${Cursor.ID}) { 
      /echo Dropping a ${Cursor.Name}... 
      /drop 
      /varcalc int_ItemsDropped ${int_ItemsDropped}+1 
   } 

   /if (${RV_DisplayStats}) /call DisplayStats 
/return 

|-------------------------------------------------------------------------------- 
|SUB: Read loot table from the INI file. 
|-------------------------------------------------------------------------------- 
Sub ReadINI(FileName,SectionName,ArrayType) 

   /echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}... 
   /delay 1s 

   /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) { 
      /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro... 
      /delay 1s 
      /return 
   } 
   /declare nValues     int local  1 
   /declare nArray      int local  0 
   /declare KeySet      string local  ${Ini[${FileName},${SectionName}]} 

   :CounterLoop 
   /if (${String[${Ini[${FileName},${SectionName},${ArrayType}${nValues}]}].Equal[null]}) { 
      /varcalc nValues ${nValues}-1 
      /goto :MakeArray 
   } 
   /varcalc nValues ${nValues}+1 
   /goto :CounterLoop 

   :MakeArray 
   /if (!${nValues}) /return 
   /if (${FileName.Equal["ForagingLoot.ini"]}&&${nValues}>0) { 
      /echo Declaring Loot Array... 
      /declare RV_LootArray[${nValues}]  string outer 
      /declare RV_LootStats[${nValues}]  string outer 
   } 

   /for nArray 1 to ${nValues} 
      /if (${FileName.Equal["ForagingLoot.ini"]}) { 
         /varset RV_LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]} 
         /varset RV_LootStats[${nArray}] 0 
      } 
   /next nArray 

   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}... 
   /delay 1s 

/return 


|-------------------------------------------------------------------------------- 
|SUB: Event subroutines. 
|-------------------------------------------------------------------------------- 

Sub Event_SkillUp(SkillUpText,Skill,int Amount) 
   /popup Foraging increased to - ${Amount} 
   /echo Foraging increased to - ${Amount} 
/return 
 
|--------------------------------------------------------------------------------
Last edited by jakevsnake on Tue May 16, 2006 5:06 pm, edited 1 time in total.

jakevsnake
orc pawn
orc pawn
Posts: 16
Joined: Sat Oct 22, 2005 1:10 pm

Post by jakevsnake » Mon May 15, 2006 3:40 am

If someone would make a Foragingloot.ini with good tradeskill foraged items for certain zones that would be great.

3djoker
a hill giant
a hill giant
Posts: 167
Joined: Thu Jun 24, 2004 11:19 pm

Post by 3djoker » Tue May 16, 2006 3:09 pm

will this auto add the items foraged to the .ini? or do you have to add them manually?

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

Post by aChallenged1 » Tue May 16, 2006 4:40 pm

Shorten the code, remove the GM check, it's worthless.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

NFC
a hill giant
a hill giant
Posts: 151
Joined: Mon Dec 19, 2005 2:16 pm

Post by NFC » Tue May 16, 2006 4:42 pm

Code brackets are your friend also

jakevsnake
orc pawn
orc pawn
Posts: 16
Joined: Sat Oct 22, 2005 1:10 pm

Post by jakevsnake » Tue May 16, 2006 5:18 pm

This macro is designed to function in an identical way to the adv_fishing macro created by Panther. You have to create a Foragingloot.ini with the zone names and the forage items you want to KEEP in it. If you forage an item that is not on your list you will drop it. If you want a forage macro to add things to your list then use the YAFM macro. I was sick of filling up my inv full of useless items so I modified the adv_fishing macro to fulfill my needs. I hope others find this useful and any suggestions for added features are welcome.

armysoldier
a hill giant
a hill giant
Posts: 189
Joined: Mon Jun 27, 2005 2:13 am
Location: Florida (Stationed at FT Carson CO)

Post by armysoldier » Tue May 16, 2006 10:21 pm

sorry Jake .. but yafm.mac <-- Yet Another forage Macro

has and still works great...

autoadds items to the ini ...

sets max quantity to default ..

is virtually flawless for a forage macro ..

JUST IMHO of vourse

ARMY

ps why fix a tire .. if its not flat?

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

Post by fearless » Tue May 16, 2006 10:44 pm

cause it didn't work exactly the way he wanted . . . why make autobot when advbot is there . . . why make advbot when genbot is around. It's not bad or wrong or anything else, just different.
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]

jakevsnake
orc pawn
orc pawn
Posts: 16
Joined: Sat Oct 22, 2005 1:10 pm

Post by jakevsnake » Tue May 16, 2006 11:34 pm

Army, fearless about sums it up. I know how YAFM works, and for many its a great macro. But like I said in the previous posts, it sucked for my needs. Most of the foraged items are garbage, so this is the best way for me to eliminate them.

armysoldier
a hill giant
a hill giant
Posts: 189
Joined: Mon Jun 27, 2005 2:13 am
Location: Florida (Stationed at FT Carson CO)

Post by armysoldier » Wed May 17, 2006 8:39 pm

I still don't understand what need it did not meet ...I use it on several bots and i have most of the crap that can not sell and is worthless set to zero .. but hey WTF do I know

I would look at adding a section to write to your ini file for new ofrages.. so you don't have to enter each and every item by hand

I would change your looting so that you destroy items not drop them so you don't look like a forage bot sitting in some zone with bags beneath you.

Or maybe what you could do is /autoinventory the items first... since /destroy destroys all item on cursor ....

Then based on INI file .. do a /finditem in your inventory .. pick them up and destroy them

just a few thoughts



and fearless .. i am trying to understand why he has problems with it ...

ARMY

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

Post by fearless » Wed May 17, 2006 9:33 pm

armysoldier wrote:and fearless .. i am trying to understand why he has problems with it ...

ARMY
fair enough ;)
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]

simkin
a snow griffon
a snow griffon
Posts: 303
Joined: Thu Sep 01, 2005 1:52 pm

Post by simkin » Thu May 18, 2006 8:17 am

The advantage I see of YAFM is that it deletes items you do not want. Having things drop to your feet is a sure sign of afk macroing. Add that option here and you have a nice alternative approach.

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Thu May 18, 2006 11:04 am

dropping items doesnt show afk macroing. I know I used to stand in one place and drop shit, its faster then hitting delete

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 » Thu May 18, 2006 12:02 pm

Yeah, we used to call them ranger/druid turds, it's really a matter of preference. I use MQ2Melee to handle the foraging and MQ2AutoDestroy to do the keep/destroy for me since plugins run independent of macros, and I can run them while doing other stuff. To each their own though, not everyone is VIP.
[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
Canadian_Cowgirl
a bunny
Posts: 245
Joined: Sat May 13, 2006 1:43 pm

Post by Canadian_Cowgirl » Thu May 18, 2006 5:08 pm

There's a list of tradeskill useable foraged items over on EQTraders

The LDoN forages are big ones, because they're such a PitA to do. Next is probably a toss up between dragon eggs (safest place is the entrance in ToV), Nodding Blue Lillies (Dreadlands hidden valley) and Dire Wolf Tufts (either Thurgadin or Icewell is safe)

Prices, of course, fluctuate between servers. I'd echo the encouragement to destroy rather than drop. GMs are known to zone in, check for druid droppings and bring a train of greens to the druid or ranger in question. A self-renewing damage shield is always a good idea. Good luck with your foraging :smile:

-C_CG
Agripa: Isn't there a rule about never getting into a fight with a Canadian when tech support is on the line?