ForageJustice.mac - Simple PoJustice forage macro

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

EnterTheFist
orc pawn
orc pawn
Posts: 17
Joined: Sat Aug 30, 2003 3:49 am

ForageJustice.mac - Simple PoJustice forage macro

Post by EnterTheFist » Sat Sep 06, 2003 6:18 pm

My first public macro, very simple; no logging or events or anything, just plain forage. Keeps Justice Fruit, Bread Crumbs, and Cockroaches. Everything else is destroyed. You can edit it to your liking, of course.

Code: Select all

|-----------------------------------------------------
| PoJustice Forage:
| An endless forage macro for PoJustice.
| Keeps Justice Fruit, Bread Crumbs, and Cockroaches
|-----------------------------------------------------

Sub Main
| Added a delay here to allow EQW users to unlock the mouse first.
  /delay 20

  :Forage
    /doability Forage
    /delay 125
    /goto :CheckItem

  :CheckItem
    /if "$cursor(name)"=="NULL" /goto :ForageDelay
    /if "$cursor(name)"=="Bread Crumbs" /goto :KeepItem
    /if "$cursor(name)"=="Justice Fruit" /goto :KeepItem
    /if "$cursor(name)"=="Cockroach" /goto :KeepItem
    /goto :DestroyItem

  :KeepItem
    /click left auto
    /goto :ForageDelay

  :DestroyItem
    /click left destroy
    /goto :ForageDelay

  :ForageDelay
    /delay 895
    /goto :Forage

/return
Enjoy.

Bones
orc pawn
orc pawn
Posts: 27
Joined: Sat Sep 07, 2002 5:37 pm

Post by Bones » Mon Sep 08, 2003 12:55 pm

You might want to consider keeping the root that is foraged there as well... It's the rarest item and from what I hear..it is valuable...

Bones

GoatFoot
a lesser mummy
a lesser mummy
Posts: 68
Joined: Fri Jan 17, 2003 1:48 am

Post by GoatFoot » Mon Sep 08, 2003 2:38 pm

just messing with you code a bit, at work, so watch for the obvious bugs.

Code: Select all


|-----------------------------------------------------
| PoJustice Forage:
| An endless forage macro for PoJustice.
| Keeps Justice Fruit, Bread Crumbs, and Cockroaches
|-----------------------------------------------------

#define KEEPLIST v1

Sub Main
| Added a delay here to allow EQW users to unlock the mouse first.
  /delay 20

  |  This could just as easily be an array, a do while loop, a p# accumulator or what have you.
  |  This method is probably unreliable for large lists actually, not sure of the char limit in a var. 
  |  Not to mention possible name confusion from the "~~" operator.... Eh,  like I said, just messing.  :)

  /varset KEEPLIST "Bread Crumbs Justice Fruit Cockroach"

  :ForageLoop
 
  :PauseLoop
  /if "$target(name,clean)"=="$char(name)" {
    /delay 30
    /goto :PauseLoop
  }

  /if n $char(ability,forage)<1 {
    /delay 10 | forage not up, lets delay and check again.
    /goto :ForageLoop
  }
  
  /doability forage
  /delay 50 | just because

  /if $cursort()!=TRUE /goto :ForageLoop

  :ClearCursor

  /if "$cursor(name)"~~"$KEEPLIST" {
    /autoinventory
  } else {
    /click left destroy
  }
  /if $cursor()==TRUE /goto :ClearCursor

  /goto :ForageLoop
/return

Shin Noir
a ghoul
a ghoul
Posts: 90
Joined: Tue Aug 05, 2003 8:18 pm

Post by Shin Noir » Mon Sep 08, 2003 2:57 pm

lol GoatFoot, was messing with it myself:

Code: Select all

|----------------------------------------------------- 
| Shin Noir's ideal AFK Forage (modified from EnterTheFist's simple PoJ forager) Sept 9th 2003
| Multi-Zone Forage: 
| An endless forage macro for any given zone. 
| Keeps items listed in forage.ini (auto-generated)
|
| Note! It is HIGHLY recommended you do NOT pick up anything while running this macro.
| Doing so MAY delete the item you have on the cursor, You have been warned.
|---------------------------------
| Commands: /mac forage [help|list|clear|add|del] "[item]"
|
| Ex: /mac forage add "Justice Fruit"
|----------------------------------------------------- 
|
| Quick Reference for Different Forage Tables:
| http://www.eqdruids.com/reference/foraging/foraging_main.htm
|
#event ZoneChange "You have entered"
#define CurZone v10

Sub Main 
/call ZoneSetup
/if "$p0"!="" /call ForageConfig "$p0" "$p1" "$p2" "$p3"


| Added a delay here to allow EQW users to unlock the mouse first. 
  /delay 20 

  :Forage 
    /if n $char(ability,"Forage")>0 /doability "Forage"  
    /doevents
    /goto :CheckItem 

  :CheckItem 
    /if "$cursor(name)"=="NULL" /goto :ForageDelay 
    /for l0 1 to $a(0,0)
     /if "$cursor(name)"=="$a(0,$l0)" /goto :KeepItem 
     /doevents
    /next l0
    /goto :DestroyItem 

  :KeepItem 
    /click left auto 
    /goto :ForageDelay 

  :DestroyItem 
    /click left destroy 
    /goto :ForageDelay 

  :ForageDelay 
    /delay 895 
    /goto :Forage 

/return 

sub ZoneSetup
 /varset CurZone "$zone"
 /for l0 1 to 10 
      /if "$ini("forage.ini","$CurZone","$l0")"=="NOTFOUND"  { 
         /goto :EndSetup
      } else { 
      /if "$ini("forage.ini","$CurZone","$l0")"=="" /goto :EndSetup
       /varset a(0,$l0) "$ini("forage.ini","$CurZone","$l0")" 
      } 
  /doevents
 /next l0  
:EndSetup
/varset a(0,0) $int($calc($l0-1)) 
/echo $a(0,0) Items set to keep on auto-forage for $zone
/return

sub event_ZoneChange
 /if "$zone"!="$CurZone" /call ZoneSetup
/return

sub ForageConfig
/if "$p0"=="help" /echo Syntax: /mac forage [help|list|clear|add|del] "[item]"
/if "$p0"=="list" {
/echo $Zone Forage List:
 /if n $a(0,0)>0 {
 /for l0 1 to $a(0,0)
  /echo $l0: $a(0,$l0)
  /doevents
 /next l0
 }
}
/if "$p0"=="add" {
 /for l0 1 to 10 
       /if "$ini("forage.ini","$CurZone","$int($calc($l0))")"=="NOTFOUND" {
        /ini "forage.ini" "$CurZone" "$l0" "$p1"
        /goto :DoneAdding
      } else {
       /if "$ini("forage.ini","$CurZone","$int($calc($l0))")"=="" {
        /ini "forage.ini" "$CurZone" "$l0" "$p1"
        /goto :DoneAdding
       }
      }
 /next l0 
 /varset l0 0
 :DoneAdding
 /if n $l0>0 /echo Added $p1 as forage item # $l0 in $Zone.
}

/if "$p0"=="del" {
 /if "$p1"=="" {
  /echo Syntax: /mac forage delete "[item]"
  /goto :DoneDeleting
 }
 /if $a(0,0)==0 {
  /echo no items in $Zone to delete.
  /goto :DoneDeleting
 }
 /for l0 1 to $a(0,0)
       /if "$ini("forage.ini","$CurZone","$int($calc($l0))")"=="$p1" {
        /for l1 1 to $calc($a(0,0)+1)
         /varadd l2 1
         /if $l1==$l0 /varadd l1 1
          /ini "forage.ini" "$CurZone" "$int($l2)" "$a(0,$l1)"
         /doevents
        /next l1
        /goto :DoneDeleting
       }
 /next l0 
 /varset l0 0
 :DoneDeleting
 /if n $l0>0 /echo Deleted $p1 from item # $l0 in $Zone.
}

/if "$p0"=="clear" {
 /if $a(0,0)==0 /goto :DoneClearing
 
 /for l0 1 to $a(0,0)
  /ini "forage.ini" "$CurZone" "$int($l0)" ""
 /next l0
 :DoneClearing
 /echo Cleared Forage List for $zone.
}

/endm
/return
I rather like this code ^^