Review of my forage macro with new code please

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

MsRandom
orc pawn
orc pawn
Posts: 11
Joined: Fri Oct 03, 2003 6:04 am

Review of my forage macro with new code please

Post by MsRandom » Fri Oct 03, 2003 6:31 am

Hiya, I was just wondering if I could get a few more eyes to double check my forage macro which I updated with the new code. (I think, hehe )

It's originally based of Grimjack's Forage.mac, and I setup the changes by looking at his Fisherman's Companion fishing macro.

Thanks in advance!

Code: Select all

||ForageDestroy.mac 
|Based off of Grimjack's forage.mac - Thank you =)
|edit the /varset DestroyArray to reflect what you want to destroy. 
|If you add more update DestArraySize to reflect the change. 
|The next value in the array would be like this. 
|/varset DestroyArray(20) "what you want" 
|And you would update DestArraySize like this. 
|/varset DestArraySize 21 
 
#define LoopCount v40 
#define ArraySize v41 
sub Main 
   /cleanup 
   /declare DestArraySize global 
   /declare LoopCount global 
   /declare DestroyArray array 
   /varset DestroyArray(0) "Pod of Water" 
   /varset DestroyArray(1) "Vineclinger Berries" 
   /varset DestroyArray(2) "Rabbit Meat" 
   /varset DestroyArray(3) "Fishing Grubs" 
   /varset DestroyArray(4) "Speckled Molded Mushroom" 
   /varset DestroyArray(5) "Sweetened Mudroot"
   /varset DestroyArray(6) "Ripened Heart Fruit"
   /varset DestroyArray(7) "Bookworm"
   /varset DestroyArray(8) "Dew of the Hatchling"
   /varset DestroyArray(9) "Jaggedpine Needles"
   /varset DestroyArray(10) "Jaggedpine Sap"
   /varset DestroyArray(11) "Shadowjade Fern Leaves"
   /varset DestroyArray(12) "Shadowjade Fern Seeds"
   /varset DestroyArray(13) "Wild Radish"
   /varset DestroyArray(14) "Small Chunk of Velium"
   /varset DestroyArray(15) "Glob of Slush Water"
   /varset DestroyArray(16) "Bark Binding"
   /varset DestroyArray(17) "Fresh Tree Sap"
   /varset DestroyArray(18) "Ripened Mango"
   /varset DestroyArray(19) "Dragon Claw Sliver"
   /varset DestArraySize 20 
   /varset LoopCount 0 
   :Forage 
       /delay 1s 
       /if "$cursor()"!="NULL" /call ItemSort 
       /if "$cursor()"=="NULL" /if n $char(ability,"Forage")>0 /doability forage 
       /if "$cursor()"!="NULL" /call ItemSort 
       /goto :Forage 
   :loop 
/return 

sub ItemSort 
   :itemchecker 
      /if "$cursor()"!="NULL" { 
         /if "$cursor(name)"~~"@DestroyArray(@LoopCount)" { 
            /echo Destroying $cursor(name) 
            /click left destroy
            /delay 2s 
         } 
      /varadd LoopCount 1 
      /if "$cursor()"!="NULL" /if n @LoopCount<@DestArraySize /goto :itemchecker 
   } 

   /if "$cursor()"!="NULL" { 
      /echo Keeping $cursor(name) 
      /autoinventory 
      /delay 1s 
   } 
   /doevents 
   /varset LoopCount 0 
/return 

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Fri Oct 03, 2003 9:10 am

You don't need the two defines.

#define LoopCount v40
#define ArraySize v41

Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

MsRandom
orc pawn
orc pawn
Posts: 11
Joined: Fri Oct 03, 2003 6:04 am

Post by MsRandom » Fri Oct 03, 2003 12:13 pm

Okies, thought that might be the case, but I'm pretty new to all this :)

Gonna post it in the depot then, thanks for the help :D