Forage of a certain item [Request Fulfilled]

Macro requests from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

eurgreef
decaying skeleton
decaying skeleton
Posts: 2
Joined: Tue Sep 17, 2002 2:32 pm

Forage of a certain item [Request Fulfilled]

Post by eurgreef » Tue Sep 17, 2002 2:43 pm

What I am looking for is a macro that lets me forage a certain item ( IE planar oak or Tea leaves) and destroy everything everything else

Thanks for the help

User avatar
DeathSpiral
a ghoul
a ghoul
Posts: 95
Joined: Thu Aug 22, 2002 6:31 pm

Re: Forage of a certain item

Post by DeathSpiral » Tue Sep 17, 2002 3:29 pm

eurgreef wrote:What I am looking for is a macro that lets me forage a certain item ( IE planar oak or Tea leaves) and destroy everything everything else
Here you go, you need to modify it to your tastes.

Code: Select all

| - foraging.mac -
| Change the Define below to the actual Foraging ability name;
| I don't know it.

#define ForaSkill Forage

sub Main
   | Add another line for each item you want to keep
   /varset a(1,0) "Planar Oak"
   /varset a(1,1) "Tea Leaves"

   /cleanup

   :Forage
      /if n $char(ability,"ForaSkill")<=0 {
         /doevents
         /goto :Forage
      }
      /doability "ForaSkill"
      /doevents
      /delay 2
      /if "$cursor()"=="TRUE"
         /goto :CheckItem
      /goto :Forage

   :CheckItem
   /call HowManyInArray 1
   /varset l0 $return

   /for l1 0 to $l0
      /if "$cursor(name)"~~"$a(1,$l1)"  /goto :KeepItem
   /next l1
   /goto :DeleteItem

   :KeepItem
      /click left auto
      /goto :Forage

   :DeleteItem
      /click left delete
      /goto :Forage
   
/return

| Returns how many items are in an array
|   Code suggested by L124RD in http://macroquest2.com/phpBB2/viewtopic.php?t=531

sub HowManyInArray
   /varset l0 0
   :loop
      /if "$a($p0,$l0)"!="" {
         /varadd l0 1
         /goto :loop
      } else {
         /if n $l0==0 /varset l0 -1
      }
/return $l0
Now, I'm not a forager, and I havn't tested / debugged the code. All I did was grab the foraging.mac I made for someone a few days back and modded it. If it works, great. If not, you should at least get some idea of what you need in your own. :)
I am orc pawn, hear me yell for centurians...

eurgreef
decaying skeleton
decaying skeleton
Posts: 2
Joined: Tue Sep 17, 2002 2:32 pm

Post by eurgreef » Tue Sep 17, 2002 7:31 pm

Thanks for the help..

Very much appreciated

inspector
orc pawn
orc pawn
Posts: 11
Joined: Fri Sep 20, 2002 9:19 pm
Location: Grand Rapids, Michigan
Contact:

I have modifid your forage macro just a bit

Post by inspector » Sat Sep 21, 2002 2:07 pm

This seems to work even better for me

Code: Select all

| - foraging.mac - 
| Change the Define below to the actual Foraging ability name; 
| I don't know it. 

#define ForaSkill Forage 

sub Main 
   | Add another line for each item you want to keep 

   /cleanup 

   :Forage 
      /doability "ForaSkill" 
      /doevents 
      /delay 2 

        /if "$cursor(name)"=="Planar Oak"  /click left auto
	/if "$cursor(name)"=="Tea Leaves"  /click left auto	
	/if "$cursor(name)"=="vegetables"  /click left auto
	/if "$cursor(name)"=="Pod of Water"  /click left auto
	/click left destroy
	/delay 305
      /goto :Forage 
/return

Meh
a lesser mummy
a lesser mummy
Posts: 32
Joined: Wed Sep 04, 2002 8:55 pm

Post by Meh » Mon Sep 23, 2002 1:21 pm

sweet! this macro is JUST what i have been looking for! 8)

Red5
decaying skeleton
decaying skeleton
Posts: 3
Joined: Tue Sep 24, 2002 4:54 pm
Location: England UK

Post by Red5 » Tue Sep 24, 2002 5:44 pm

My first post!

I have a slight problem with the above macro’s (not too impugn your work chaps). Ok, lets say your up in Growth foraging Planar Oak, running the macro, you open your inventory and click on a backpack, or worse, an epic or piece of armour….

The chances are your going to have auto destroy on, its a pain in the ass if you haven’t….

POOF, bye bye expensive_piece_o_armour_01

I did have a need for this type of macro recently, almost made that mistake (the penny dropped while I was coding), a far far better idea is to tell the macro ‘what’ to destroy. With this macro anything on your cursor is checked, if its NOT on your destroy list, it auto equips it.

Code: Select all

 | - Forage.mac -
| - Adapted from Fish.mac by Red5

#include routines.mac

Sub Main

:forage
	/doability 2

|Or whatever slot your forage skill is in.

	/if "$cursor()"=="NULL" /goto :forage
	/if "$cursor()"=="TRUE" /call checkcur
	/goto :forage
/return

sub checkcur

/echo $cursor(name)
	
	/if "$invpanel"!="TRUE" /press i
	/if "$cursor(name)"=="Pod of Water" /click left destroy 
	/if "$cursor(name)"=="Roots" /click left destroy 
	/if "$cursor(name)"=="Vegetables" /click left destroy 
	/if "$cursor(name)"=="Fruit" /click left destroy 
	/if "$cursor(name)"=="Berries" /click left destroy 
	/if "$cursor(name)"=="Rabbit Meat" /click left destroy 
	/if "$cursor(name)"=="Fishing Grubs" /click left destroy
	/if "$cursor(name)"=="Thunderhoof Mushroom" /click left destroy
	
	/delay 7
	/click left auto
	/press i
/return 
I know you could probably add more code to stop auto destroying epic_01 or bacpack_03. This is just a quick simple macro that gets the job done, without any risk.

Hope this helps some….

inspector
orc pawn
orc pawn
Posts: 11
Joined: Fri Sep 20, 2002 9:19 pm
Location: Grand Rapids, Michigan
Contact:

wow your on the ball

Post by inspector » Tue Sep 24, 2002 10:10 pm

I had that happen last night with a no drop shield =) got it back from GM though, so I think I will be using your macro instead =D thanks a ton chap. I did change mine a little though instead of destroying foraged stuff it just drops it on the ground =) so no chance of dropping epic or no drop gear

justme
decaying skeleton
decaying skeleton
Posts: 1
Joined: Fri Dec 06, 2002 10:36 am

Dropping stuff I want!

Post by justme » Fri Dec 06, 2002 10:38 am

After fidgeting with MQ, I finally got it to work and love it. This macro is great, only it drops the item I actually WANT to forage?

What can I add so that when I actually forage what I want (Planar Oak, Clockwork Grease), it will put it in my inventory?

Thanks for any help.

noaim
decaying skeleton
decaying skeleton
Posts: 1
Joined: Fri Dec 06, 2002 11:26 am

inventory

Post by noaim » Fri Dec 06, 2002 11:28 am

I like this macro alot but could anyone mod it so when it does forage what I'm looking for it fills up my bags in my invintory?

Thanks

Doh!
decaying skeleton
decaying skeleton
Posts: 5
Joined: Thu Nov 28, 2002 7:42 pm

After a bit of experimentation....

Post by Doh! » Sun Dec 08, 2002 1:56 am

I just added in the gm check and sub crap, so dunno how well that part works.....

Code: Select all

sub main

:loop
/if $gm==TRUE /call Crap
/delay 25
/call forage
/goto :loop
/return

sub forage
	/if n $char(ability,"Forage")<=0 /return
	/doability Forage
      	/delay 20
	/call check
	/return

sub check
	/if "$cursor(name)"=="Branch of Planar Oak" /click left auto
	/if "$cursor(name)"=="Morning Dew" /click left auto
	/if "$cursor(name)"=="Oak Bark" /click left auto
	/if "$cursor(name)"=="Cinnamon Sticks" /click left auto
	/click left destroy
	/return

Sub Crap
   /beep
   /cleanup
   /beep
   /sit
   /beep
   /unload
/return
Works for me as at 200 forage you will always get something...

And to drop it in inventory, you need to have inventory window open. If not, it will try to drop everything foraged, no matter what it is....


Gah... Just re-read and saw the part about telling it what to destroy... Could easily be done in sub check if you knew all the forageables you might be getting... Will modify it....I also had the problem of things i didnt want destroyed going bye bye, and I like your idea of telling it what to destroy much better than telling it what to keep and pitch the rest....

Doh!
decaying skeleton
decaying skeleton
Posts: 5
Joined: Thu Nov 28, 2002 7:42 pm

Ok...

Post by Doh! » Sun Dec 08, 2002 2:25 am

Code: Select all

sub main

:loop
      /if $gm==TRUE /call Crap
      /delay 25
      /call forage
      /goto :loop
/return

sub forage

      /if n $char(ability,"Forage")<=0 /return
      /doability Forage
      /delay 20
      /call check
/return

sub check

      /if "$cursor(name)"=="Fruit" /click left destroy
      /if "$cursor(name)"=="Berries" /click left destroy
      /if "$cursor(name)"=="Vegetables" /click left destroy
      /if "$cursor(name)"=="Rabbit meat" /click left destroy
      /if "$cursor(name)"=="Roots" /click left destroy
      /if "$cursor(name)"=="Pod of Water" /click left destroy
      /if "$cursor(name)"=="Fishing Grubs" /click left destroy
      /if "$cursor(name)"=="Glob of Slush Water" /click left destroy
      /if "$cursor(name)"=="Small Chunk of Velium " /click left destroy
      /if "$cursor(name)"=="Cracked Dragon Bone" /click left destroy
      /if "$cursor(name)"=="Ripened Mango" /click left destroy
      /click left auto
/return

Sub Crap

      /beep
      /cleanup
      /beep
      /sit
      /beep
      /unload
/return
Will let you know in a bit how this works....

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Re: Ok...

Post by L124RD » Sun Dec 08, 2002 2:41 am

Salutations,

Code: Select all

sub main

:loop
      /if $gm==TRUE /call Crap
      /delay 25
      /call forage
      /goto :loop
/return

sub forage

      /if n $char(ability,"Forage")<=0 /return
      /doability Forage
      /delay 20
      /call check
/return

sub check
      /varset p0 $invpanel
      /call invwait TRUE
      /if "$cursor(name)"=="Fruit" /click left destroy
      /if "$cursor(name)"=="Berries" /click left destroy
      /if "$cursor(name)"=="Vegetables" /click left destroy
      /if "$cursor(name)"=="Rabbit meat" /click left destroy
      /if "$cursor(name)"=="Roots" /click left destroy
      /if "$cursor(name)"=="Pod of Water" /click left destroy
      /if "$cursor(name)"=="Fishing Grubs" /click left destroy
      /if "$cursor(name)"=="Glob of Slush Water" /click left destroy
      /if "$cursor(name)"=="Small Chunk of Velium " /click left destroy
      /if "$cursor(name)"=="Cracked Dragon Bone" /click left destroy
      /if "$cursor(name)"=="Ripened Mango" /click left destroy
      /click left auto
      /call invwait $p0
/return

Sub Crap

      /beep
      /cleanup
      /beep
      /sit
      /beep
      /unload
/return

sub invwait
      :invwaitloop
        /doevents
        /if $invpanel!=$p0 {
         /press i
         /goto :invwaitloop
        }
/return
if invpanel was closed, it'll open it... if it was closed before, it'll close it again :p

bugcoder
orc pawn
orc pawn
Posts: 26
Joined: Mon Nov 04, 2002 1:11 am

thanks guys

Post by bugcoder » Thu Dec 12, 2002 3:56 pm

I destroyed my 6th shawl by mistake. I will change my code as well. Thanks guys.