forage.mac - The stupidest looking forage macro yet.

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

Moderator: MacroQuest Developers

Sp4rky
decaying skeleton
decaying skeleton
Posts: 2
Joined: Thu Apr 22, 2004 3:45 pm

Post by Sp4rky » Tue Jun 01, 2004 2:48 pm

Preocts, just want to say THANKS, this macro is working great for me!! Runs w/out a hitch. I had a question though, is there any way that a string can be added to this to click the track button as its refreshed?

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Tue Jun 01, 2004 10:04 pm

The Oid-friendly forrage macro:

Code: Select all

Sub Main 
  :Loop 
     /if (${Cursor.ID}) /autoinventory
     /if (${Me.AbillityReady[Forage]}) /doability Forage 
  /goto :Loop 
/return

Glasscoin
a lesser mummy
a lesser mummy
Posts: 55
Joined: Mon Jan 13, 2003 8:57 am

Post by Glasscoin » Wed Jun 02, 2004 7:56 pm

Code: Select all

Sub Main 
  :Loop 
     /if (${Cursor.ID}) /multiline ; /autoi ; /goto :Loop
     /if (${Me.AbilityReady[Forage]}) /multiline ; /doability Forage ; /goto :Loop
/return
Less efficient, but less lines!

Sp4rky
decaying skeleton
decaying skeleton
Posts: 2
Joined: Thu Apr 22, 2004 3:45 pm

Post by Sp4rky » Wed Jun 02, 2004 9:56 pm

weird, ever since the patch this morning and the New release of MQ2 this macro for some reason isnt auto-inventorying (... anyone have any ideas why?

s16z
a ghoul
a ghoul
Posts: 97
Joined: Thu Apr 01, 2004 12:03 pm

Post by s16z » Wed Jun 02, 2004 11:00 pm

Actually, Glasscoin, your macro won't forage more than 1 time. The line

Code: Select all

/if (${Me.AbilityReady[Forage]}) /multiline ; /doability Forage ; /goto :Loop

says "if forage is ready, do the multiline command of forage, and goto :loop. Rewriting it as:

Code: Select all

/multiline ; /if (${Me.AbilityReady[Forage]}) /doability Forage ; /goto :Loop
and if that works, we can reduce the whole damn thing to:

Code: Select all

Sub Main
    :loop
    /multiline ; /if (${Cursor.ID}) /autoinv ; /if (${Me.AbilityReady[Forage]}) /doability Forage ; /goto :Loop
    /return

Glasscoin
a lesser mummy
a lesser mummy
Posts: 55
Joined: Mon Jan 13, 2003 8:57 am

Post by Glasscoin » Thu Jun 03, 2004 9:16 am

I have been owned. :smile:

s16z
a ghoul
a ghoul
Posts: 97
Joined: Thu Apr 01, 2004 12:03 pm

Post by s16z » Thu Jun 03, 2004 10:19 am

Now we need Lax to embrace the ideals of Pearl and APL, and we can convert the whole macro to something like:

Code: Select all

Main Sub
   :loop
    % ^ #[!@#%$@] :loop
This macro would forage, level all your alts to 65, get you 200 AA points, and wash your car.

helstar
orc pawn
orc pawn
Posts: 21
Joined: Sat Jan 24, 2004 6:23 pm

update

Post by helstar » Thu Jun 03, 2004 11:19 pm

So what is the update to the macro. I can see how you are useing the 2 lines to fixe the mac. Since i done see the loop part in there.

Code: Select all

#Event Foraged "#*#You have scrounged#*#" 
#Event ForageFail "#*#You fail to locate any food nearby.#*#" 

Sub Main 
/declare GeneralTimeout timer outer 0 
/declare IniFileName string outer ${Me.Name}_IniFile.ini 
:MainLoop 
    /call Main_AutoForage 
  /goto :MainLoop 
/return 

Sub Main_AutoForage 
    /if (${Me.AbilityReady["Forage"]}) { 
      /if (${Me.Combat}) { 
        /attack off 
        /delay 1s !${Me.Combat} 
        /declare SetCombat int local 1 
      } 
      | 2) Massive check for all contitions that prevent foraging. 
      /if (!${Me.Mount.ID} && !${Me.Casting.ID} && !${Window[SpellBookWnd].Open} && !${Me.Combat} && !${Window[LootWnd].Open} && !${Window[BigBankWnd].Open} && !${Cursor.ID} && !${Window[MerchantWnd].Open}) { 
        /varset GeneralTimeout 5s 
        /if (${Me.Sitting}) { 
          /sit 
          /delay 5 
          /doability "Forage" 
          /sit 
        } else { 
          /doability "Forage" 
        } 
        /ini "${IniFileName}" "ForageStats" "Attempts" "${Math.Calc[${Ini[${IniFileName},ForageStats,Attempts,0]}+1]}" 
        :ForageWaitLoop 
          /doevents Foraged 
          /doevents ForageFailed 
          /delay 1 
          /if (${Macro.Return.NotEqual[FORAGE_DONE]} && ${GeneralTimeout}) /goto :ForageWaitLoop 
        /call ClearReturn 
      } 
      /if (${Defined[SetCombat]}) /attack on 
    } 
/return 

|// ------------BEGIN FORAGE-------------- 

Sub Event_Foraged 
  | Sub Event_Foraged () 
  | For use with an Event that is tiggered on successful forage attempt. 
  | Returns: FORAGE_DONE on all exits 
  /call IniScan Forage 0 
/return FORAGE_DONE 

Sub Event_ForageFail 
  | Sub Event_ForageFail () 
  | For use with an event triggered on failed forage attempt 
  | Returns: FORAGE_DONE on all exits 
  /ini "${IniFileName}" "ForageStats" "Failures" "${Math.Calc[${Ini[${IniFileName},ForageStats,Failures,0]}+1]}" 
/return FORAGE_DONE 

|// ------------ END FORAGE -------------- 

|// ------------BEGIN SHARED-------------- 

Sub IniScan(SkillName,EmptyCursor) 
  | Sub IniScan (SkillName,EmptyCursor) 
  | For use with an Ini. Scans ini for item on cursor and controls action for that item. 
  | Stats are written to ini in Key [SkillName]Stats. Item information is written/read from key [ItemList] 
  | If EmptyCursor is set to 1 then no stats are written to the INI 
  | Returns: DONE on all exits 
  | Required Subs: Sub HandleCursor (Command;ItemName) 
  :WaitForEQ 
    /if (!${GeneralTimeout}) /return DONE 
    /if (!${Cursor.ID}) /goto :WaitForEQ 
  /declare ItemName string local ${Cursor.Name} 
  /declare ItemID int local ${Cursor.ID} 
  /ini "${IniFileName}" "Settings" "LastItem${SkillName}" "${ItemName}" 
  /ini "${IniFileName}" "${SkillName}Totals" "${ItemName}" "${Math.Calc[${Ini[${IniFileName},${SkillName}Totals,${ItemName},0]}+1]}" 
  /if (!${EmptyCursor}) /ini "${IniFileName}" "${SkillName}Stats" "Success" "${Math.Calc[${Ini[${IniFileName},${SkillName}Stats,Success,0]}+1]}" 
| Run a quick check to see if we've ever found this before. 

  /if (${Ini[${IniFileName},ItemList,${ItemName},NOTFOUND].Equal[NOTFOUND]}) { 
    /if (${Ini[${IniFileName},Settings,Noise,0]}) /echo Just found << ${ItemName} >> ! Never seen this before. Adding to the list and keeping all of them by default. 
    /ini "${IniFileName}" "ItemList" "${ItemName}" "-1" 
  } 

| Check to see what to do with this item. Notice default is -1. This is to help prevent destruction of equipment. 

  /if (${Ini[${IniFileName},ItemList,${ItemName},-1]}) { 
    | Is there a set max-keep value and how many do we have? If we have too many, send a destroy call. 
    /if (${Ini[${IniFileName},ItemList,${ItemName},-1]}!=-1) { 
      /if (${FindItemCount[=${ItemName}]}>=${Ini[${IniFileName},ItemList,${ItemName},-1]}) { 
        /if (${Ini[${IniFileName},Settings,Noise,0]}) /echo Just found << ${ItemName} >> but we have too many. Destroying it. 
        /goto :Destroy 
      } 
    } 
    /if (${Ini[${IniFileName},Settings,Noise,0]}) /echo Just found << ${ItemName} >> and I'm sending it to the inventory. 
    /if (!${EmptyCursor}) /ini "${IniFileName}" "${SkillName}Stats" "Keep" "${Math.Calc[${Ini[${IniFileName},${SkillName}Stats,Keep,0]}+1]}" 
    /call HandleCursor Loot;${ItemID} 
  } else { 
    /if (${Ini[${IniFileName},Settings,Noise,0]}) /echo Just found << ${ItemName} >> but we don't want it. Destroying it. 
    :Destroy 
    /if (!${EmptyCursor}) /ini "${IniFileName}" "${SkillName}Stats" "Destroy" "${Math.Calc[${Ini[${IniFileName},${SkillName}Stats,Destroy,0]}+1]}" 
    /call HandleCursor Destroy;${ItemID} 
  } 
/return DONE 

Sub HandleCursor 
  | Sub HandleCursor (Command;ItemID) 
  | Does a given command with a given item if and only if that item is currently on the cursor. CHECKS BY ${CURSOR.ID} !!! 
  | Commands:  Destroy -- will destroy item 
  |            Loot    -- will loot item 
  :ReDo 
  /if (!${Param0.Arg[2,;].Length}) /return 
  /if (${Cursor.ID}!=${Param0.Arg[2,;]}) /return 
  /if (${Param0.Arg[1,;].Equal["Destroy"]}) /destroy 
  /if (${Param0.Arg[1,;].Equal["Loot"]}) /autoinven 
  /delay 5 
  /if (!${Cursor.ID}) /return 
  /if (${Cursor.ID}==${Param0.Arg[2,;]}) /goto :ReDo 
/return 

Sub ClearReturn 
  | Sub ClearReturn "" 
  | Clears ${Macro.Return} of any value 
/return "" 

VirusX
orc pawn
orc pawn
Posts: 14
Joined: Sun May 16, 2004 7:52 pm

great mac

Post by VirusX » Sat Jun 19, 2004 2:20 am

I love this forage mac. Thanks Preocts. Since the update i think its bugged tho. Its just straight out destroying everything it forages... Not sure why. I tried recreating the mac and the personal ini it creates. Still doing it. *shrug*

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Sat Jun 26, 2004 1:53 pm

Can someone post this macro in its entirety? I'm not sure what's going on with Preocts, but I'd like to see it.

Thanks!

VirusX
orc pawn
orc pawn
Posts: 14
Joined: Sun May 16, 2004 7:52 pm

Post by VirusX » Sun Jun 27, 2004 12:55 am

Ya it really whoops the llamas ass =)
C'mon Preocts hook us up with your awesome mac.

macrolover
a ghoul
a ghoul
Posts: 107
Joined: Sun Jul 14, 2002 9:19 am

here guy's

Post by macrolover » Sun Jun 27, 2004 9:16 am

here gang may not be newest release.

Code: Select all

#Event Foraged "#*#You have scrounged#*#"
#Event ForageFail "#*#You fail to locate any food nearby.#*#"

Sub Main
/declare GeneralTimeout timer outer 0
/declare IniFileName string outer ${Me.Name}_IniFile.ini
:MainLoop
    /call Main_AutoForage
  /goto :MainLoop
/return

Sub Main_AutoForage
    /if (${Me.AbilityReady["Forage"]}) {
      /if (${Me.Combat}) {
        /attack off
        /delay 1s !${Me.Combat}
        /declare SetCombat int local 1
      }
      | 2) Massive check for all contitions that prevent foraging.
      /if (!${Me.Mount.ID} && !${Me.Casting.ID} && !${Window[SpellBookWnd].Open} && 

!${Me.Combat} && !${Window[LootWnd].Open} && !${Window[BigBankWnd].Open} && !${Cursor.ID} && 

!${Window[MerchantWnd].Open}) {
        /varset GeneralTimeout 5s
        /if (${Me.Sitting}) {
          /sit
          /delay 5
          /doability "Forage"
          /sit
          /delay 5
          /autoinventory
        } else {
          /doability "Forage"
          /delay 5
          /autoinventory
        }
        /ini "${IniFileName}" "ForageStats" "Attempts" 

"${Math.Calc[${Ini[${IniFileName},ForageStats,Attempts,0]}+1]}"
        :ForageWaitLoop
          /doevents Foraged
          /doevents ForageFailed
          /delay 1
          /if (${Macro.Return.NotEqual[FORAGE_DONE]} && ${GeneralTimeout}) /goto 

:ForageWaitLoop
        /call ClearReturn
      }
      /if (${Defined[SetCombat]}) /attack on
    }
/return

|// ------------BEGIN FORAGE--------------

Sub Event_Foraged
  | Sub Event_Foraged ()
  | For use with an Event that is tiggered on successful forage attempt.
  | Returns: FORAGE_DONE on all exits
  /call IniScan Forage 0
/return FORAGE_DONE

Sub Event_ForageFail
  | Sub Event_ForageFail ()
  | For use with an event triggered on failed forage attempt
  | Returns: FORAGE_DONE on all exits
  /ini "${IniFileName}" "ForageStats" "Failures" 

"${Math.Calc[${Ini[${IniFileName},ForageStats,Failures,0]}+1]}"
/return FORAGE_DONE

|// ------------ END FORAGE --------------

|// ------------BEGIN SHARED--------------

Sub IniScan(SkillName,EmptyCursor)
  | Sub IniScan (SkillName,EmptyCursor)
  | For use with an Ini. Scans ini for item on cursor and controls action for that item.
  | Stats are written to ini in Key [SkillName]Stats. Item information is written/read from 

key [ItemList]
  | If EmptyCursor is set to 1 then no stats are written to the INI
  | Returns: DONE on all exits
  | Required Subs: Sub HandleCursor (Command;ItemName)
  :WaitForEQ
    /if (!${GeneralTimeout}) /return DONE
    /if (!${Cursor.ID}) /goto :WaitForEQ
  /declare ItemName string local ${Cursor.Name}
  /declare ItemID int local ${Cursor.ID}
  /ini "${IniFileName}" "Settings" "LastItem${SkillName}" "${ItemName}"
  /ini "${IniFileName}" "${SkillName}Totals" "${ItemName}" 

"${Math.Calc[${Ini[${IniFileName},${SkillName}Totals,${ItemName},0]}+1]}"
  /if (!${EmptyCursor}) /ini "${IniFileName}" "${SkillName}Stats" "Success" 

"${Math.Calc[${Ini[${IniFileName},${SkillName}Stats,Success,0]}+1]}"
| Run a quick check to see if we've ever found this before.

  /if (${Ini[${IniFileName},ItemList,${ItemName},NOTFOUND].Equal[NOTFOUND]}) {
    /if (${Ini[${IniFileName},Settings,Noise,0]}) /echo Just found >;>; ${ItemName} << ! 

Never seen this before. Adding to the list and keeping all of them by default.
    /ini "${IniFileName}" "ItemList" "${ItemName}" "-1"
  }

| Check to see what to do with this item. Notice default is -1. This is to help prevent 

destruction of equipment.

  /if (${Ini[${IniFileName},ItemList,${ItemName},-1]}) {
    | Is there a set max-keep value and how many do we have? If we have too many, send a 

destroy call.
    /if (${Ini[${IniFileName},ItemList,${ItemName},-1]}!=-1) {
      /if (${FindItemCount[=${ItemName}]}<=${Ini[${IniFileName},ItemList,${ItemName},-1]}) {
        /if (${Ini[${IniFileName},Settings,Noise,0]}) /echo Just found >> ${ItemName} << but 

we have too many. Destroying it.
        /goto :Destroy
      }
    }
    /if (${Ini[${IniFileName},Settings,Noise,0]}) /echo Just found >> ${ItemName} << and I'm 

sending it to the inventory.
    /if (!${EmptyCursor}) /ini "${IniFileName}" "${SkillName}Stats" "Keep" 

"${Math.Calc[${Ini[${IniFileName},${SkillName}Stats,Keep,0]}+1]}"
    /call HandleCursor Loot;${ItemID}
  } else {
    /if (${Ini[${IniFileName},Settings,Noise,0]}) /echo Just found >> ${ItemName} << but we 

don't want it. Destroying it.
    :Destroy
    /if (!${EmptyCursor}) /ini "${IniFileName}" "${SkillName}Stats" "Destroy" 

"${Math.Calc[${Ini[${IniFileName},${SkillName}Stats,Destroy,0]}+1]}"
    /call HandleCursor Destroy;${ItemID}
  }
/return DONE

Sub HandleCursor
  | Sub HandleCursor (Command;ItemID)
  | Does a given command with a given item if and only if that item is currently on the 

cursor. CHECKS BY ${CURSOR.ID} !!!
  | Commands:  Destroy -- will destroy item
  |            Loot    -- will loot item
  :ReDo
  /if (!${Param0.Arg[2,;].Length}) /return
  /if (${Cursor.ID}!=${Param0.Arg[2,;]}) /return
  /if (${Param0.Arg[1,;].Equal["Destroy"]}) /destroy
  /if (${Param0.Arg[1,;].Equal["Loot"]}) /autoinven
  /delay 5
  /if (!${Cursor.ID}) /return
  /if (${Cursor.ID}==${Param0.Arg[2,;]}) /goto :ReDo
/return

Sub ClearReturn
  | Sub ClearReturn ""
  | Clears ${Macro.Return} of any value
/return ""
fixed the &gt: and < crap
Last edited by macrolover on Mon Jul 05, 2004 12:27 am, edited 4 times in total.

eluminate
orc pawn
orc pawn
Posts: 16
Joined: Wed Apr 28, 2004 4:20 am

Post by eluminate » Mon Jun 28, 2004 12:03 am

im running this at home now, seesms to auto destroy eeverything

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

Top Personalized Golf Headcovers Info

Post by FrankJScott » Tue Apr 15, 2025 7:09 pm

In reply to the people asking about fairway headcovers, the golfers club sale, nice golf club sets, wooden golf shaft, wooden fairway woods, unusual golf head covers, golf club wood set, headcover hybrid, good hybrid golf clubs, golf woods set for sale, 3 wood from the fairway, hybrid club covers, types of golf sticks, hybrid wood set, driver head covers, hybrid club for sale, golf set reviews, cool golf club head covers, buy fairway woods, clubs every golfer should have, I suggest this weblink about premium golf headcovers advice for golf covers for clubs, compare fairway woods, 23 hybrid golf club, new fairway woods, fairway wood covers, hybrid golf clubs for women, types of headcovers, driver and 3 wood, golf club covers woods, the golf club of, golf club shopping, perfect golf clubs, cheap 3 hybrid golf club, driver fairway wood set, hybrid wood covers, golfers club logo, playing golf at home, golf irons sets for sale, hybrid headcovers, head covers for golf woods, 3 wood and hybrid head covers, hybrid headcover set, also. See More Useful Pshot Services Sarasota Tips b86b3ce

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

Recommended Bwf Livescore Tips

Post by FrankJScott » Fri Apr 25, 2025 6:37 pm

In response to the people asking about skor pertandingan indonesia, jadwal pertandingan sepak bola besok, berita olahraga sepak bola terkini, pemain bola di indonesia, melihat pertandingan sepak bola, nama pemain bola indonesia, vs madrid, berita terbaru transfer pemain, jadwal bola indonesia besok, jadwal pertandingan bola terlengkap, I highly recommend this new bwf livescore blog or skor sepak bola terbesar di dunia, hasil pertandingan hari ini indonesia, indonesia streaming live, info sepak bola dunia, livescore liga 1, update hasil liga 1, bola sepak bola adalah, melihat pertandingan sepak bola, lihat pertandingan, berita pertandingan bola, which is worth considering with this use this link on livescore indonesia advice which is worth considering with info liga 1 indonesia, skor live bola, liga women, tv online siaran langsung sepak bola, sepak bola seluruh indonesia, pemain sepak bola terkenal indonesia, live streaming di indonesia, info jadwal sepak bola, informasi bola terkini, liga 1 di indonesia, alongside all this see about bwf livescore blog which is also great. Also, have a look at this the original source on jadwal bola forum not forgetting sites such as skor live indonesia, pertandingan live indonesia, kabar berita sepak bola, hasil pertandingan bola hari ini indonesia, liga 1 indonesia livescore, skor liga indonesia hari ini, sepak bola berita, streaming live bola indonesia, live skor terlengkap, bola baru, as well as this great sepak bola details bearing in mind live skor liga 1 hari ini, skor hari ini liga 1, bola ini malam indonesia, live bola indonesia vs, pertandingan sepak bola malam ini indonesia, i loved this about on top of sepak bola sekarang ini, pertandingan live sekarang, pertandingan bola live, live indonesia hari ini sepak bola, hasil sepak bola dunia, for good measure. Check more @ Excellent Natural Pet Supplements Blog 1d1ac78