Moderator: MacroQuest Developers
I filter macro output so I do not see this. In the macroquest.ini there is an option for this.Wassup wrote:I like the macro, but don;t like the spam when nothing in the list is able to be targetted.
Do you think you could add like a 1 minute delay if nothing is targettable before it tries to target a mob in the list?
Code: Select all
sub GetTarget
:Aquire
/target nopcnear $KSRadius npc "$a(2,$rand($MobArraySize))"
/varset MyTarget $target(id)
/varset TargetDead 0
/if n $target(id)==0 {
/delay 60s
/goto :Aquire
}
/if $target()=="False" {
/delay 60s
/goto :Aquire
}
/varset HasTarget 1
/return
I do not see "Macroquest is active".Wassup wrote:I figured it out and did exactly what you did. Thanks for the post though, others might want to use it.
Also thanks for the pointer on the filters... didn't even think of looking there.
Does the Macro's Filter also remove the Macroquest output in general, for example the Macroquest is active text, or echo's? Or is that the Debug filter?
Code: Select all
#define MyXLOC v40
#define MyYLOC v41
#define KSRadius v42
#define NotSee v43
#define TooFar v44
#define MyTarget v45
#define TargetDead v46
#define HasTarget v47
#define MobToHunt v48
#define ObstCount v49
#define LootSlot v50
#define CheckLoot v51
#define LootTotal v52
#define MobArraySize v53
#define MobDistance v54
#define LoopCount v55
#define DefKeep v56
#define UseCamo v57
#define MousePos v58
Sub Main
/zapvars
/cleanup
/press alt
/press shift
/press ctrl
/varset LootSlot 0
/varset CheckLoot 0
/varset a(1,0) "Griffon Meat"
/varset a(1,1) "Roots"
/varset a(1,2) "Tuft of Dire Wolf Fur"
/varset a(1,3) "Egg"
/varset a(1,4) "Morning Dew"
/varset a(1,5) "Branch of Planar Oak"
/varset a(1,6) "Plant Shoot"
/varset LootTotal 7
/varset a(2,0) "griffon"
/varset a(2,1) "griffawn"
/varset KSRadius 60
/varset HasTarget 0
/varset ObstCount 0
/varset MobArraySize 2
/varset UseCamo "TRUE"
/varset DefKeep "TRUE"
/delay 1s
/lootn never
:Start
/call GMAlert
/varset MousePos "$mouse(X) $mouse(Y)"
/varset MobDistance 100
/if "$UseCamo"=="TRUE" /alt activate 80
/call doForage
/call GetTarget
/if $HasTarget=="1" /call MoveToMob
| /if $HasTarget=="1" /call CheckKs
/if $HasTarget=="1" /call CombatSub
/if $HasTarget=="1" /call MoveToMob
/if "$cursor()"!="NULL" /call itemSort
/if $HasTarget=="1" /call LootMob
/call ResetSub
/goto :Start
/return
sub GMAlert
/alert add 1 pc GM
/target alert 1
/if $target()!=FALSE {
/endmacro
/unload
/q
}
/return
sub GetTarget
:Aquire
/target nopcnear $KSRadius npc "$a(2,$rand($MobArraySize))"
/varset MyTarget $target(id)
/varset TargetDead 0
/if n $target(id)==0 /goto :Aquire
/if $target()=="False" /goto :Aquire
/varset HasTarget 1
/return
sub MoveToMob
/delay 2s
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/if n $target(distance)<=$MobDistance {
/face fast nopredict
/return
}
/sendkey down up
:Movementloop
/varadd ObstCount 1
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
/face fast nopredict
/if n $target(distance)<=$MobDistance {
/face fast
/sendkey up up
/delay 1
/return
}
/if $ObstCount>=3 {
/call CheckObst
/goto :Movementloop
}
/if n $target(distance)>$MobDistance /goto :MovementLoop
/return
sub CheckKS
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
/target nopcnear $KSRadius npc "$MobToHunt"
/if $target(id)!=$MyTarget {
/echo Target $target(id) and MyTrgId $MyTarget does not match
/echo Starting fresh with new target.
/varset HasTarget 0
/return
}
/return
sub CombatSub
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
:combatloop
/if n $target(id)==0 /goto :combatEnd
/if n $target(distance)<$KSRadius {
/face fast nopredict
/sendkey down down
/goto :combatloop
}
/if n $target(distance)>=$MobDistance /sendkey up down
/press down
/face fast nopredict
/delay 1s
/if n $target(distance)<$KSRadius /goto :combatloop
/cast 5
/cast 5
/delay 55
/if n $target(id)==0 /goto :combatEnd
/if n $target(distance)<$KSRadius /goto :combatloop
/cast 1
/cast 1
/delay 75
/if n $target(id)!=0 {
/if "$UseCamo"=="TRUE" /alt activate 80
/delay 30s
/if n $target(id)!=0 /goto :combatloop
}
:combatEnd
/varset MobDistance 14
/delay 1s
/target id $MyTarget
/return
sub doForage
/if n $char(ability,"Forage")>0 {
/if "$cursor()"!="NULL" /call itemSort
/delay 5
/doability forage
/delay 5
/if "$cursor()"!="NULL" /call itemSort
}
/return
sub itemSort
/varset LoopCount 0
:itemchecker
/if "$cursor(name)"~~"$a(1,$LoopCount)" {
/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<$LootTotal /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 LootMob
/loot
/delay 2s
:lootloop
/if n $LootSlot==0 /click left loot2
/if n $LootSlot==1 /click left loot3
/if n $LootSlot==2 /click left loot4
/if n $LootSlot==3 /click left loot5
/if n $LootSlot==4 /click left loot6
/if n $LootSlot==5 /click left loot7
/if n $LootSlot==6 /click left loot8
/if n $LootSlot==7 /click left loot9
/if n $LootSlot==8 /click left loot10
/if n $LootSlot==9 /goto :doneloot
/delay 1
/if "$cursor()"!="NULL" {
/call itemSort
/delay 1
/varadd LootSlot 1
/goto :lootloop
}
:doneloot
/varset LootSlot 0
/call itemSort
/delay 5
/return
sub ResetSub
/sendkey up up
/cleanup
/press alt
/press shift
/press ctrl
/varset CheckLoot 0
/varset HasTarget 0
/varset ObstCount 0
/delay 1s
/return
sub CheckObst
/if n $MyXLOC==$char(x) /if n $MyYLOC==$char(y) /call HitObst 5
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/varset ObstCount 0
/return
sub HitObst
/sendkey up up
/sendkey down down
/if n $rand(99)>50 {
/delay 1s
/sendkey up down
/sendkey down Right
/delay $p0
/sendkey up Right
/sendkey down up
/delay 1s
/sendkey up up
} else {
/delay 1s
/sendkey up down
/sendkey down left
/delay $p0
/sendkey up left
/sendkey down up
/delay 1s
/sendkey up up
}
/sendkey up down
/sendkey up Right
/sendkey up Left
/sendkey down up
/returnCode: Select all
/if n $LootSlot==0 /click left loot2
/if n $LootSlot==1 /click left loot3
/if n $LootSlot==2 /click left loot4
/if n $LootSlot==3 /click left loot5
/if n $LootSlot==4 /click left loot6
/if n $LootSlot==5 /click left loot7
/if n $LootSlot==6 /click left loot8
/if n $LootSlot==7 /click left loot9
/if n $LootSlot==8 /click left loot10
/if n $LootSlot==9 /goto :donelootCode: Select all
/click left corpse $LootSlotCode: Select all
| hunter.mac
| Hunt script with loot for new loot parser.
| As always much of this script is inspired or taken directly from
| pieces of macro's found at macroquest2.com's macro depot
| Thank you to all the people who have donated their scripts which
| made this possible. And thank you to the MQ developers.
|
| Edit /varset a(1,0) "silk" and /varset a(1,1) "skin"
| Also edit /varset a(2,0) "widow" and /varset a(2,1) "wolf"
| You can also make these arrays bigger. If you want to search for
| wolfs, widows and orcs you would have this
| /varset a(2,0) "widow"
| /varset a(2,1) "wolf"
| /varset a(2,2) "orc"
| /varset MobArraySize 3
| This picks a random number based on MobArraySize to pick which
| Type of mob it will chose from the array.
|
| What type of loot you want can be expanded in a similar way to
| the mobs you want to hunt. Just add your array entry and update
| /varset LootTotal 2 to be /varset LootTotal [# of loot entries]
|
| Another thing, for the code to actualy destroy items you don't want to
| keep you must have fast item destroy turned on in the game. I would
| test the script for a while on your machine before doing this. It would
| really suck if it picks up your Eyepatch of Plunder and destroies it
| due to a bug.
|
| ## Okay this will twist in combat songs and selo's during the aquire target phase :)
| ## Special thanks to all the others that made this possible
#define MyXLOC v40
#define MyYLOC v41
#define KSRadius v42
#define NotSee v43
#define TooFar v44
#define MyTarget v45
#define TargetDead v46
#define HasTarget v47
#define MobToHunt v48
#define ObstCount v49
#define LootSlot v50
#define CheckLoot v51
#define LootTotal v52
#define MobArraySize v53
#define MobDistance v54
#define Song v55
#event MissedNote "You miss a note, bringing your song to a close!"
Sub Main
/zapvars
/press esc
/press esc
/press esc
/press esc
/press alt
/press shift
/press ctrl
/varset LootSlot 0
/varset CheckLoot 0
/varset a(1,0) "silk"
/varset a(1,1) "quality"
/varset a(1,2) "Greater"
/varset LootTotal 3
/varset a(2,0) "spider"
/varset a(2,1) "cat"
/varset a(2,2) "wolf"
/varset a(2,3) "bear"
/varset a(2,4) "wisp"
/varset KSRadius 60
/varset HasTarget 0
/varset ObstCount 0
/varset MobArraySize 5
/varset MobDistance 14
/varset Song 2
/delay 1s
/lootn never
:Start
/call GetTarget
/if $HasTarget=="1" /call MoveToMob
/if $HasTarget=="1" /call CheckKs
/if $HasTarget=="1" /call CombatSub
/if $HasTarget=="1" /call MoveToMob
/if $HasTarget=="1" /call LootMob
/call ResetSub
/goto :Start
/return
sub GetTarget
:Aquire
/target nopcnear $KSRadius npc range 10 13 "$a(2,$rand($MobArraySize))"
/varset MyTarget $target(id)
/varset TargetDead 0
/if n $target(id)==0 /goto :Aquire
/if $target()=="False" /goto :Aquire
/varset HasTarget 1
/return
sub MoveToMob
/delay 2s
/stopsong
/cast 1
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/if n $target(distance)<=$MobDistance {
/face fast nopredict
/return
}
/sendkey down up
:Movementloop
/varadd ObstCount 1
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
/face fast nopredict
/if n $target(distance)<=$MobDistance {
/face fast
/sendkey up up
/return
}
/if $ObstCount>=3 {
/call CheckObst
/goto :Movementloop
}
/if n $target(distance)>$MobDistance /goto :MovementLoop
/return
sub CheckKS
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
/target nopcnear $KSRadius npc "$MobToHunt"
/if $target(id)!=$MyTarget {
/echo Target $target(id) and MyTrgId $MyTarget does not match
/echo Starting fresh with new target.
/varset HasTarget 0
/return
}
/return
sub CombatSub
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
/attack on
:combatloop
/face fast nopredict
|/call BackstabIt
/if n $target(distance)>13 {
/sendkey down up
/goto :combatloop
}
/if n $target(distance)<=$MobDistance /sendkey up up
/face fast nopredict
|Put the Call CombatSongs in here because otherwise you will be chasing your target aimlessly
/call CombatSongs
/if n $target(id)==0 /varset TargetDead 1
/if n $TargetDead!=1 /goto :combatloop
/delay 1s
/target id $MyTarget
/return
sub LootMob
/loot
/delay 2s
:lootloop
/click left corpse $LootSlot
/if n $LootSlot==9 /goto :doneloot
/delay 1s
/if "$cursor()"!="TRUE" /goto :doneloot
:lootChecker
/if "$cursor(name)"~~"$a(1,$CheckLoot)" {
/delay 1s
/click left auto
/varadd LootSlot 1
/goto :lootloop
}
/varadd CheckLoot 1
/if "$cursor()"=="TRUE" {
/if n $CheckLoot<$LootTotal /goto :lootchecker
}
/if "$cursor()"=="TRUE" {
/delay 1s
/click left destroy
/delay 1s
}
/varadd LootSlot 1
/varset CheckLoot 0
/goto :lootloop
:doneloot
/varset LootSlot 0
/return
sub ResetSub
/sendkey up up
/press esc
/press esc
/press esc
/press esc
/press alt
/press shift
/press ctrl
/varset CheckLoot 0
/varset HasTarget 0
/varset ObstCount 0
/delay 1s
/return
sub CheckObst
/if n $MyXLOC==$char(x) /if n $MyYLOC==$char(y) /call HitObst 5
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/varset ObstCount 0
/return
sub HitObst
/sendkey up up
/sendkey down down
/if n $rand(99)>50 {
/delay 3s
/sendkey up down
/sendkey down Right
/delay $p0
/sendkey up Right
/sendkey down up
/delay 3s
/sendkey up up
} else {
/delay 3s
/sendkey up down
/sendkey down left
/delay $p0
/sendkey up left
/sendkey down up
/delay 3s
/sendkey up up
}
/sendkey up down
/sendkey up Right
/sendkey up Left
/sendkey down up
/return
Sub CombatSongs
/stopsong
/delay 3
/cast $Song
/doevents
/delay 27
/varadd Song 1
/if n $Song==5 {
/varset Song 2
}
/return
Sub Event_MissedNote
/cast $Song
/delay 4
/doevents
/return
Yeah sorry for posting it that way. My loot slots are off by 2 for some reason and I don't have title bars.somemage wrote:ChangetoCode: Select all
/if n $LootSlot==0 /click left loot2 /if n $LootSlot==1 /click left loot3 /if n $LootSlot==2 /click left loot4 /if n $LootSlot==3 /click left loot5 /if n $LootSlot==4 /click left loot6 /if n $LootSlot==5 /click left loot7 /if n $LootSlot==6 /click left loot8 /if n $LootSlot==7 /click left loot9 /if n $LootSlot==8 /click left loot10 /if n $LootSlot==9 /goto :donelootCode: Select all
/click left corpse $LootSlot