Moderator: MacroQuest Developers
Code: Select all
| Name:
| -----
| Forage.mac
|
| Authors:
| --------
| GrimJack, Kagonis
|
| Description:
| ------------
| This forage macro is optimized for druids (or rangers) that
| have the AA called Innate Camouflage.
|
| The following variables can be changed to suit your needs:
| /varset UseCamo <TRUE|FALSE> = Use Innate Camouflage AA
| between forages? Good for foraging places where there are
| roamers.
| /varset DefKeep <TRUE|FALSE> = Keep or Destroy the items
| listed in the array, per default, ie:
| - /varset DefKeep TRUE : If you wish to keep the items
| listed in the array, and destroy the rest (risky: read warning).
| - /varset DefKeep FALSE : If you wish to destroy the items
| listed in the array, and keep the rest (safest: read warning).
| /varset useExodus <TRUE|FALSE> = Use the AA Exodus to get out of
| trouble? Only applicable if isCoward is TRUE.
| /varset isCoward <TRUE|FALSE> = Cast a spell, or use Exodus when
| you get hit? Remember to set if you wan to use Exodus, or what
| spell gem to cast.
| /varset useSpell <FALSE|1-8> = Use spell? And what spell gem.
| /varset spellTime <integer> = The casting time of the selected
| spell, in tenth of seconds.
|
| To add new items that you wish to keep or destroy, to your array
| you simply add a new line like these:
| /varset a(1,0) "Roots"
| /varset a(1,1) "Tuft of Dire Wolf Fur"
| /varset a(1,2) "#Egg"
| All items will be EXACT matches, except if it is prepended by a #
| Ie: "Roots" will ONLY match "Roots", and not "Lichen Roots",
| "#Roots" on the other hand will match any item containing "Roots",
| Ie: "#Roots" matches both "Roots" and "Lichen Roots".
|
| Remember to update the ArraySize accordingly to the number of
| items in your array:
| /varset ArraySize 3
|
| ** WARNING WARNING **
| If you decide to use the KEEP list, then you will have to make
| sure that you don't put something on your cursor that you would
| not risk to loose.
| ** WARNING WARNING **
|Enabling #turbo makes the client lag for some reason.
|#turbo
#event beingHit " hits YOU for "
#event spellLOM "Insufficient Mana to cast this spell!"
#event spellInterrupted "Your spell is interrupted."
#event spellFizzle "Your spell fizzles!"
#define LoopCount v1
#define ArraySize v2
#define MousePos v3
#define DefKeep v4
#define UseCamo v5
#define thisItem v6
#define beExact v7
#define useExodus v8
#define useSpell v9
#define spellTime v10
#define isCoward v11
sub Main
/varset a(1,0) "#Egg"
/varset a(1,1) "Tuft of Dire Wolf Fur"
/varset a(1,2) "Roots"
/varset a(1,3) "Morning Dew"
/varset a(1,4) "Branch of Planar Oak"
/varset a(1,5) "Plant Shoot"
/varset ArraySize 6
/varset UseCamo "FALSE"
/varset DefKeep "TRUE"
/varset useExodus "FALSE"
/varset useSpell "FALSE" | FALSE or the spell gem to use/cast.
/varset spellTime 500 | in 1/10 seconds
/varset isCoward "FALSE"
/cleanup
:Loop
/call doForage
/doevents
/goto :Loop
/return
sub beCoward
/cast $useSpell
/delay $spellTime
/delay 5
/doevents
/return
sub doForage
/if n $char(ability,"Forage")>0 {
/if "$cursor()"!="NULL" /call ItemSort
/delay 5
/doability forage
/if "$UseCamo"=="TRUE" /alt activate 80
/delay 5
/if "$cursor()"!="NULL" /call ItemSort
}
/return
sub itemSort
/varset MousePos "$mouse(X) $mouse(Y)"
/delay 5
/varset LoopCount 0
:itemchecker
/if "$a(1,$LoopCount)"~~"#" {
/varset thisItem "$right($calc($strlen("$a(1,$LoopCount)")-1),"$a(1,$LoopCount)")"
/varset beExact 0
} else {
/varset thisItem "$a(1,$LoopCount)"
/varset beExact 1
}
/if n $beExact==0 /if "$cursor(name)"~~"$thisItem" {
/if "$DefKeep"=="TRUE" {
/echo Keeping: << $cursor(name) >>
/click left auto
} else {
/echo Destroying: << $cursor(name) >>
/click left destroy
}
/delay 5
} else /if n $beExact==1 /if "$cursor(name)"=="$thisItem" {
/if "$DefKeep"=="TRUE" {
/echo Keeping: << $cursor(name) >>
/click left auto
} else {
/echo Destroying: << $cursor(name) >>
/click left destroy
}
/delay 5
}
/varadd LoopCount 1
/if "$cursor()"!="NULL" {
/if n $LoopCount<$ArraySize /goto :itemchecker
}
/if "$cursor()"!="NULL" {
/if "$DefKeep"=="TRUE" {
/echo Destroying: << $cursor(name) >>
/click left destroy
} else {
/echo Keeping: << $cursor(name) >>
/click left auto
}
/delay 5
}
/mouseto $MousePos
/return
sub Event_spellLOM
/return
sub Event_beingHit
/call chkCoward
/return
sub Event_spellInterrupted
/call chkCoward
/return
sub Event_spellFizzle
/call chkCoward
/return
sub chkCoward
/if "$isCoward"!="TRUE" /goto :End
/if "$useExodus"!="TRUE" {
/alt activate 43
/goto :End
}
/if "$useSpell"!="FALSE" {
/call beCoward
}
:End
/returnCode: Select all
| Name:
| -----
| Forage.mac
|
| Authors:
| --------
| GrimJack, Kagonis
|
| Description:
| ------------
| This forage macro is optimized for druids.
|
| The following variables can be changed to suit your needs:
| /varset UseCamo <TRUE|FALSE> = Use Innate Camouflage AA
| between forages? Good for foraging places where there are
| roamers.
|
| /varset DefKeep <TRUE|FALSE> = Keep or Destroy the items
| listed in the array, per default, ie:
| - /varset DefKeep TRUE : If you wish to keep the items
| listed in the array, and destroy the rest (risky: read warning).
| - /varset DefKeep FALSE : If you wish to destroy the items
| listed in the array, and keep the rest (safest: read warning).
| /varset useExodus <TRUE|FALSE> = Use the AA Exodus to get out of
| trouble? Only applicable if isCoward is TRUE.
| /varset isCoward <TRUE|FALSE> = Cast a spell, or use Exodus when
| you get hit? Remember to set if you wan to use Exodus, or what
| spell gem to cast.
| /varset useSpell <FALSE|1-8> = Use spell? And what spell gem.
|
| To add new items that you wish to keep or destroy, to your array
| you simply add a new line like these:
| /varset a(1,0) "Roots"
| /varset a(1,1) "Tuft of Dire Wolf Fur"
| /varset a(1,2) "#Egg"
| All items will be EXACT matches, except if it is prepended by a #
| Ie: "Roots" will ONLY match "Roots", and not "Lichen Roots",
| "#Roots" on the other hand will match any item containing "Roots",
| Ie: "#Roots" matches both "Roots" and "Lichen Roots".
|
| ** WARNING WARNING **
| If you decide to use the KEEP list, then you will have to make
| sure that you don't put something on your cursor that you would
| not risk to loose.
| ** WARNING WARNING **
|Enabling #turbo makes the client lag for some reason.
|#turbo
#event beingHit " hits YOU for "
#event spellLOM "Insufficient Mana to cast this spell!"
#event spellInterrupted "Your spell is interrupted."
#event spellFizzle "Your spell fizzles!"
#event zoned "LOADING, PLEASE WAIT..."
#define ArraySize v1
#define DefKeep v2
#define UseCamo v3
#define useExodus v4
#define useSpell v5
#define isCoward v6
sub Main
/varset a(1,0) "#Egg"
/varset a(1,1) "Vegetables"
/varset a(1,2) "Fruit"
/varset a(1,3) "Morning Dew"
/varset a(1,4) "Branch of Planar Oak"
/varset a(1,5) "Plant Shoot"
/varset a(1,6) "Clockwork Grease"
/varset a(1,7) "Tuft of Dire Wolf Fur"
/varset DefKeep "TRUE"
/varset UseCamo "TRUE"
/varset isCoward "TRUE"
/varset useExodus "FALSE"
/varset useSpell "1" | FALSE or the spell gem to use/cast.
/cleanup
/call doBegin
/varset ArraySize $return
/if "$p0"=="" /goto :Loop
/echo -----
/if "$DefKeep"=="TRUE" {
/echo Will KEEP for this session:
} else {
/echo Will DESTROY for this session:
}
/echo -----
/varset l0 0
:Input
/echo $p$int($l0)
/varset a(1,$ArraySize) "$p$int($l0)"
/varadd ArraySize 1
/varadd l0 1
/if n $int($l0)>9 /endmacro
/if "$p$int($l0)"=="" {
/goto :Begin
} else {
/goto :Input
}
:Begin
/echo -----
/echo Total of $int($ArraySize) items.
:Loop
/call doForage
/doevents
/goto :Loop
/return
sub doBegin
/echo Foraging...
/if "$UseCamo"=="TRUE" {
/echo Use Innate Camouflage: TRUE
} else {
/echo Use Innate Camouflage: FALSE
}
/if "$isCoward"=="TRUE" {
/echo You are a coward: TRUE
} else {
/echo You are a coward: FALSE
}
/if "$isCoward"=="TRUE" /if "$useExodus"=="TRUE" /echo Use Exodus if combat.
/if "$isCoward"=="TRUE" /if "$useSpell"!="FALSE" /echo Use Gem$useSpell: $char(gem,$useSpell), $spell("$char(gem,$useSpell)",casttime)sec casting.
/echo -----
/if "$DefKeep"=="TRUE" {
/echo Will KEEP
} else {
/echo Will DESTROY
}
/echo -----
/varset l0 0
:Loop
/if "$a(1,$int($l0))"=="" {
/if n $l0==0 /echo Nothing on the list.
/goto :End
}
/echo $a(1,$l0)
/varadd l0 1
/goto :Loop
:End
/return $l0
sub beCoward
/if "$char(state)"=="STAND" /goto :Cast
/stand
:Cast
/cast $useSpell
/delay $calc($spell("$char(gem,$useSpell)",casttime)*10)
/delay 5
/doevents
/return
sub doForage
/if n $char(ability,"Forage")>0 {
/if "$cursor()"!="NULL" /call ItemSort
/if "$char(state)"=="SIT" {
/varset l0 "TRUE"
/stand
}
/doability forage
/if "$UseCamo"=="TRUE" /alt activate 80
/delay 5
/if "$l0"=="TRUE" {
/sit on
/varset l0 "FALSE"
}
/if "$cursor()"!="NULL" /call ItemSort
}
/return
sub itemSort
/varset l2 "$mouse(X) $mouse(Y)"
/delay 5
/varset l3 0
:itemchecker
/if "$a(1,$l3)"~~"#" {
/varset l0 "$right($calc($strlen("$a(1,$l3)")-1),"$a(1,$l3)")"
/varset l1 0
} else {
/varset l0 "$a(1,$l3)"
/varset l1 1
}
/if n $l1==0 /if "$cursor(name)"~~"$l0" {
/if "$DefKeep"=="TRUE" {
/echo Keeping: << $cursor(name) >>
/click left auto
} else {
/echo Destroying: << $cursor(name) >>
/click left destroy
}
/delay 5
} else /if n $l1==1 /if "$cursor(name)"=="$l0" {
/if "$DefKeep"=="TRUE" {
/echo Keeping: << $cursor(name) >>
/click left auto
} else {
/echo Destroying: << $cursor(name) >>
/click left destroy
}
/delay 5
}
/varadd l3 1
/if "$cursor()"!="NULL" {
/if n $l3<$ArraySize /goto :itemchecker
}
/if "$cursor()"!="NULL" {
/if "$DefKeep"=="TRUE" {
/echo Destroying: << $cursor(name) >>
/click left destroy
} else {
/echo Keeping: << $cursor(name) >>
/click left auto
}
/delay 5
}
/mouseto $l2
/return
sub chkCoward
/if "$isCoward"!="TRUE" /goto :End
/if "$useExodus"=="TRUE" {
/alt activate 43
/goto :End
}
/if "$useSpell"!="FALSE" {
/call beCoward
}
:End
/return
Sub ItemOnCursor
/varset t1 5
:ItemOnLoop
/delay 0
/if $cursor()!=TRUE /if n $t1>0 /goto :ItemOnLoop
/return
Sub ItemNotOnCursor
/varset t2 5
:ItemOnLoop
/delay 0
/if $cursor()==TRUE /if n $t2>0 /goto :ItemOnLoop
/return
sub Event_spellLOM
/return
sub Event_beingHit
/call chkCoward
/return
sub Event_spellInterrupted
/call chkCoward
/return
sub Event_spellFizzle
/call chkCoward
/return
sub Event_zoned
/if "$isCoward"!="TRUE" /goto :End
/endmacro
/unload
/q
:End
/return