Moderator: MacroQuest Developers

Here you go, you need to modify it to your tastes.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
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
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
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 
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
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
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