Sigh another forage

Got a cool macro idea? Wanna request a macro? Here is the place for you!

Moderator: MacroQuest Developers

tex
decaying skeleton
decaying skeleton
Posts: 3
Joined: Tue Nov 18, 2003 1:11 am
Contact:

Sigh another forage

Post by tex » Tue Nov 18, 2003 1:16 am

I did in fact use search...searched forage. 2 pages long, I checked every single thread, and couldnt find anything that I was looking for. First post here, but I been reading awhile trying to learn as much as possible. Everything is up and working, as far as the program.

Still looking for a forage macro that will keep everything...I dont mind it being all fancy and keeping certain things...hell it can keep everything it wants, im in this for skill-ups.

But I also want it to put it in inventory for me, and loop. I found one that did it once, but then I had to load the mac file again.

All the others spammed red text error in my chat window.

If someone could help me out with info or basic script...Id be very thankful.

**Note:** I heard somethign about new ui being no good...is that maybe why none of the ones I found worked? Just curious.

NotSoCSharp
a ghoul
a ghoul
Posts: 85
Joined: Sat Oct 25, 2003 10:48 am

Post by NotSoCSharp » Tue Nov 18, 2003 8:22 am

Here is my feeble attempt at this. Let me know if it works for you.

Code: Select all

|  There are only two sections of the ini file for this macro and they are described below.
|
|  
| The bufs section is the list of buffs you want to keep on the toon while he forages. 
| MAKE SURE YOU HAVE THESE SPELLS MEMORIZED!!!!!
| It is best to list the invis spell last or it will get recast until all buffs are done.
|
| [Bufs]
| Buf1=Nature's Might
| Buf2=Protection of the Cabbage
| Buf3=Improved Superior Camouflage
|
|
| The forage section lists all the items you want to DESTORY!!!
| Don't list an item here if you want to keep it.
|
| [Forage]
| Dest1=Ripened Mango
| Dest2=Fresh Tree Sap
| Dest3=Bark Bindings


#turbo 
#define INIPATH "autoforage.ini" 

#include routines.mac

#event Appear "You appear."
#event Interrupt "Your spell is interrupted."
#event Fizzle "Your spell fizzles!" 
#event Recover "You haven't recovered yet..."

Sub Main 
   /call DefineGlobals
   /call DoLog "Starting to forage in $zone."
   :loop 
      /call CheckBufs
      /call Forage
      /delay 3s
   /goto :loop 
/endmacro


Sub CheckDestroy
   
   /declare i local
   
   
   /if n @NumForage==0 /return
      
   /for i 1 to @NumForage
      /if $cursor()=="TRUE" {
         /if n @i==1 /call DoLog "I foraged a '$cursor(name)'."
         /if "$cursor(name)"=="@forage(@i)" {
            /call DoLog "I am destroying $cursor(name)."
            /if $invpanel!=TRUE /press I
            /click left destroy
            /call WaitForDrop
         }
      }
   /next i
   /if $invpanel==TRUE /press I
   
/return

Sub Forage
      /if n $char(ability,"Forage")!=-2 {
         /doability "Forage"
         /call WaitForPickup
         /call CheckDestroy 
         /call putaway
      }
/return

Sub CheckBufs

   /declare i local
   
   /if n @NumBufs==0 /return

   /for i 1 to @NumBufs
      /if n $char(buff,"@bufs(@i)")==0 /call Rebuf
   /next i

/return

Sub ReBuf

   /declare i local
   
   /if n @NumBufs==0 /return

   /press F1
   /sendkey up up
   /delay 1s
   :DoOver
      /varset Zone 0 
      /for i 1 to @NumBufs
         :DoOver
         /if n $char(buff,"@bufs(@i)")==0 { 
            /call DoLog "Casting @bufs(@i)."
            /cast "@bufs(@i)"
            /call WaitForSpell
            /doevents 
            /if n @Zone==1 /goto :DoOver
         }
      /next i
   /varset Zone 0
/return

Sub Event_Appear
   /sendkey up up
   /varset Zone 1
/return

Sub Event_Interrupt
   /sendkey up up
   /varset Zone 1
/return

Sub Event_Fizzle
   /sendkey up up
   /varset Zone 1
/return

Sub Event_Recover
   /sendkey up up
   /varset Zone 1
/return

Sub LoadForage

   /varset NumForage 0
   
   :Loop
      /varadd NumForage 1
      /varset forage(@NumForage) "$ini("INIPATH","Forage","Dest$int(@NumForage)")" 
      /if "@forage(@NumForage)"=="NOTFOUND" { 
            /varsub NumForage 1
            /goto :End
      } 
      /call DoLog "Loaded $ini("INIPATH","Forage","Dest$int(@NumForage)") into array"
      /goto :Loop
   :End
   /call DoLog "NumForage = @NumForage"
/return

Sub LoadBufs

   /varset NumBufs 0
   
   :Loop
      /varadd NumBufs 1
      /varset bufs(@NumBufs) "$ini("INIPATH","Bufs","Buf$int(@NumBufs)")" 
      /if "@bufs(@NumBufs)"=="NOTFOUND" { 
            /varsub NumBufs 1
            /goto :End
      } 
      /goto :Loop
   :End
   /call DoLog "Number of bufs loaded @NumBufs"
/return


Sub WaitForPickup 
   :waiting 
   /if "$cursor()"=="NULL" /goto :waiting 
/return 
   
Sub WaitForDrop 
   :waiting 
   /if $cursor()==TRUE /goto :waiting 
/return
   
Sub DoLog 
   /mqlog @Param0 
   /echo @Param0 
/return

Sub WaitForSpell

   :Spell
   /delay 1s
   /if $char(casting)==TRUE /goto :Spell
   /delay 1s

/return

Sub putaway
   :Loop
      /delay 1s
      /if $cursor()==TRUE {
         /autoinventory
         /goto :Loop
      }
/return

Sub DefineGlobals 


/declare bufs array
/declare forage array

/declare NumBufs global
/declare Zone global
/declare NumForage global

/varset Zone 0

/call LoadBufs
/call LoadForage

/return 

tex
decaying skeleton
decaying skeleton
Posts: 3
Joined: Tue Nov 18, 2003 1:11 am
Contact:

Post by tex » Tue Nov 18, 2003 10:25 am

I put this in a ini file
| [Bufs]
| Buf1=Nature's Might
| Buf2=Protection of the Cabbage
| Buf3=Improved Superior Camouflage
|
|
| The forage section lists all the items you want to DESTORY!!!
| Don't list an item here if you want to keep it.
|
| [Forage]
| Dest1=Ripened Mango
| Dest2=Fresh Tree Sap
| Dest3=Bark Bindings

Then I put the code from "Sub Main" and down in a .mac file.

Got a few errors...maybe I did somethign wrong...I so suck at this.

chimaera
a lesser mummy
a lesser mummy
Posts: 37
Joined: Fri Aug 01, 2003 4:14 pm

Post by chimaera » Tue Nov 18, 2003 10:42 am

Content of INI file

Code: Select all

[Bufs] 
Buf1=Nature's Might 
Buf2=Protection of the Cabbage 
Buf3=Improved Superior Camouflage 

[Forage] 
Dest1=Ripened Mango 
Dest2=Fresh Tree Sap 
Dest3=Bark Bindings 
Content of MAC file

Code: Select all

#turbo 
#define INIPATH "autoforage.ini" 

#include routines.mac 

#event Appear "You appear." 
#event Interrupt "Your spell is interrupted." 
#event Fizzle "Your spell fizzles!" 
#event Recover "You haven't recovered yet..." 

Sub Main 
   /call DefineGlobals 
   /call DoLog "Starting to forage in $zone." 
   :loop 
      /call CheckBufs 
      /call Forage 
      /delay 3s 
   /goto :loop 
/endmacro 


Sub CheckDestroy 
    
   /declare i local 
    
    
   /if n @NumForage==0 /return 
      
   /for i 1 to @NumForage 
      /if $cursor()=="TRUE" { 
         /if n @i==1 /call DoLog "I foraged a '$cursor(name)'." 
         /if "$cursor(name)"=="@forage(@i)" { 
            /call DoLog "I am destroying $cursor(name)." 
            /if $invpanel!=TRUE /press I 
            /click left destroy 
            /call WaitForDrop 
         } 
      } 
   /next i 
   /if $invpanel==TRUE /press I 
    
/return 

Sub Forage 
      /if n $char(ability,"Forage")!=-2 { 
         /doability "Forage" 
         /call WaitForPickup 
         /call CheckDestroy 
         /call putaway 
      } 
/return 

Sub CheckBufs 

   /declare i local 
    
   /if n @NumBufs==0 /return 

   /for i 1 to @NumBufs 
      /if n $char(buff,"@bufs(@i)")==0 /call Rebuf 
   /next i 

/return 

Sub ReBuf 

   /declare i local 
    
   /if n @NumBufs==0 /return 

   /press F1 
   /sendkey up up 
   /delay 1s 
   :DoOver 
      /varset Zone 0 
      /for i 1 to @NumBufs 
         :DoOver 
         /if n $char(buff,"@bufs(@i)")==0 { 
            /call DoLog "Casting @bufs(@i)." 
            /cast "@bufs(@i)" 
            /call WaitForSpell 
            /doevents 
            /if n @Zone==1 /goto :DoOver 
         } 
      /next i 
   /varset Zone 0 
/return 

Sub Event_Appear 
   /sendkey up up 
   /varset Zone 1 
/return 

Sub Event_Interrupt 
   /sendkey up up 
   /varset Zone 1 
/return 

Sub Event_Fizzle 
   /sendkey up up 
   /varset Zone 1 
/return 

Sub Event_Recover 
   /sendkey up up 
   /varset Zone 1 
/return 

Sub LoadForage 

   /varset NumForage 0 
    
   :Loop 
      /varadd NumForage 1 
      /varset forage(@NumForage) "$ini("INIPATH","Forage","Dest$int(@NumForage)")" 
      /if "@forage(@NumForage)"=="NOTFOUND" { 
            /varsub NumForage 1 
            /goto :End 
      } 
      /call DoLog "Loaded $ini("INIPATH","Forage","Dest$int(@NumForage)") into array" 
      /goto :Loop 
   :End 
   /call DoLog "NumForage = @NumForage" 
/return 

Sub LoadBufs 

   /varset NumBufs 0 
    
   :Loop 
      /varadd NumBufs 1 
      /varset bufs(@NumBufs) "$ini("INIPATH","Bufs","Buf$int(@NumBufs)")" 
      /if "@bufs(@NumBufs)"=="NOTFOUND" { 
            /varsub NumBufs 1 
            /goto :End 
      } 
      /goto :Loop 
   :End 
   /call DoLog "Number of bufs loaded @NumBufs" 
/return 


Sub WaitForPickup 
   :waiting 
   /if "$cursor()"=="NULL" /goto :waiting 
/return 
    
Sub WaitForDrop 
   :waiting 
   /if $cursor()==TRUE /goto :waiting 
/return 
    
Sub DoLog 
   /mqlog @Param0 
   /echo @Param0 
/return 

Sub WaitForSpell 

   :Spell 
   /delay 1s 
   /if $char(casting)==TRUE /goto :Spell 
   /delay 1s 

/return 

Sub putaway 
   :Loop 
      /delay 1s 
      /if $cursor()==TRUE { 
         /autoinventory 
         /goto :Loop 
      } 
/return 

Sub DefineGlobals 


/declare bufs array 
/declare forage array 

/declare NumBufs global 
/declare Zone global 
/declare NumForage global 

/varset Zone 0 

/call LoadBufs 
/call LoadForage 

/return

NotSoCSharp
a ghoul
a ghoul
Posts: 85
Joined: Sat Oct 25, 2003 10:48 am

Post by NotSoCSharp » Tue Nov 18, 2003 12:29 pm

Sorry I was not more clear about that. :oops:

Doodman
a ghoul
a ghoul
Posts: 124
Joined: Thu Jan 02, 2003 12:07 pm

Post by Doodman » Tue Nov 18, 2003 3:06 pm

LOL.. Why make it so difficult for a simple forage macro?

Code: Select all

#turbo

Sub Main
  
   /cleanup
   /press i
   :loop
      /if n $char(ability,Forage)>0 {
         /delay 2
         /doability Forage
         /delay 10
         /if $cursor()==TRUE {
            /echo Keeping $cursor(name) ($count("$cursor(name)"))
            /autoinventory
         }
      }
       /delay 10
    /goto :loop
/return
This is a stripped down version of what I use when foraging stuff for Blessed Fishing rods. I had to add delays in case of lag, etc.. Works like a champ.

It spits out:
[MacroQuest] Keeping Branch of Planar Oak (5)

The number ends up being how many you have, not including the one you just had. Changing that is left as an exercise for the reader.
Doodman
EQEmu Developer
www.eqemulator.net

NotSoCSharp
a ghoul
a ghoul
Posts: 85
Joined: Sat Oct 25, 2003 10:48 am

Post by NotSoCSharp » Tue Nov 18, 2003 4:05 pm

Well I actually enjoyed creating it and did not find it difficult at all. Plus I wanted to give people a foundation to build on if they want. :D

tex
decaying skeleton
decaying skeleton
Posts: 3
Joined: Tue Nov 18, 2003 1:11 am
Contact:

Post by tex » Tue Nov 18, 2003 7:36 pm

well thanks, im glad you took the time to help me out,a nd to explain it.

I, interested in understanding this kind of stuff.

ty again, works well