hunter.mac Basic hunter script with loot capability.

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

Moderator: MacroQuest Developers

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Tue May 27, 2003 11:55 pm

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?

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Delay

Post by grimjack » Wed May 28, 2003 2:43 am

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?
I filter macro output so I do not see this. In the macroquest.ini there is an option for this.

If you still want a delay after failing to get a target here is how you would do it. It will pause 60 seconds after failing to target a mob. Just replace the GetTarget sub with this one. If you want to make sure that it checks all mobs in the list before doing the delay the target portion will need to be totaly changed. At the moment I pick random every time and don't keep track of what we have already tried. This method works for my means so I don't plan on working on it. You can lower they delay by changing both /delay 60s to somthing lower like 30s.

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 

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Wed May 28, 2003 5:10 am

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?

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Wed May 28, 2003 6:06 am

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?
I do not see "Macroquest is active".
I do see /echo's

I prefer to run with as little output as possible unless I'm debuging a script..

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Sat May 31, 2003 5:44 pm

Modified GrimJack's cool hunter script to better fit the needs of a druid.
Basically I made it so it root and dots a mob instead of backstabs it, also added forage to it, just comment out the /call doForage if you dont forage.

Modified the sorting algorithm a bit as well, no big deal.

Oh, the distance to mob thing doesn't seem to work allways, usually it does, but sometimes it just forgets about it it seems.

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
/return

Wendel
a lesser mummy
a lesser mummy
Posts: 58
Joined: Wed Jul 24, 2002 1:48 am

Problem with click

Post by Wendel » Sun Jun 01, 2003 12:02 pm

Sorry to be such a noob.

My macro doesn't click the loot slots.

I was wondering if someone could go through what ui files I have to edit to make this work.

It will click destroy or auto okay, just won't pick up the items in the loot window

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Sun Jun 01, 2003 3:37 pm

Remove titlebar in your loot window?

somemage
a lesser mummy
a lesser mummy
Posts: 35
Joined: Mon May 12, 2003 7:44 pm

Post by somemage » Sun Jun 01, 2003 5:26 pm

Change

Code: 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 :doneloot
to

Code: Select all

      /click left corpse $LootSlot

Wendel
a lesser mummy
a lesser mummy
Posts: 58
Joined: Wed Jul 24, 2002 1:48 am

:)

Post by Wendel » Sun Jun 01, 2003 5:54 pm

That worked!

Thanks

Wendel
a lesser mummy
a lesser mummy
Posts: 58
Joined: Wed Jul 24, 2002 1:48 am

Bard version

Post by Wendel » Sun Jun 01, 2003 8:06 pm

Thanks to all that made this possible!

This is for a lowbie bard, it targets wisps as well(really need cash badly)
It only keeps greater lightstones(guess I don't need cash that bad hehe)


Selo's in slot one
Your other three combat songs in spell slots 2 3 4
You could twist 4 combat songs if your connection can handle it, but 3 works good for me

Code: 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

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Sun Jun 01, 2003 8:19 pm

somemage wrote:Change

Code: 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 :doneloot
to

Code: Select all

      /click left corpse $LootSlot
Yeah sorry for posting it that way. My loot slots are off by 2 for some reason and I don't have title bars.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Jun 02, 2003 8:52 am

A lot of people have loot slots off by two. Your best bet is to test run any macro and figure out if you have to start counting at 0 or at 2 and adjust your script.

For example, my loot slots work fine, starting from 0, but my merchant window needs me to start counting at 2. I'm beginning to think there's no universal solution, based on the number of different UI's out there. What we have is a pretty good generic solution that works for most things. I'll keep tinkering with it as time allows, maybe we can fine tune things a bit. Right now I'm deferring to Shark on most of the parser however, since his understanding of XML is obviously far superior to mine.
MQ2: Think of it as Evolution in action.

papiraul
a lesser mummy
a lesser mummy
Posts: 76
Joined: Fri Sep 27, 2002 8:46 am

Post by papiraul » Mon Jun 02, 2003 9:02 am

Can't we all agree on a UI that can be used when doing macros?
Like the Default one?

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Jun 02, 2003 9:15 am

Nope, I hate the default UI. And if we use that one we have additional complications, namely scroll bars.

One of my requirements for ParseMouseLoc is that it be generic. It has to support the majority of the UI's and not restrict us to just one. There will always be problems with the truly exotic skins, but we can come very close to supporting the rest. We already have in fact. But I won't insist that people use my UI (which worked great with the parser before Shark got involved), or that we insist on one standard interface.

And, since I seem to be the dev in charge of mouse related stuff by default, I ain't gonna change the source code if it doesn't live up to my standards. We don't need a single UI, we need better code.
MQ2: Think of it as Evolution in action.

papiraul
a lesser mummy
a lesser mummy
Posts: 76
Joined: Fri Sep 27, 2002 8:46 am

Post by papiraul » Tue Jun 03, 2003 4:10 am

Sounds good to me man.. you tha boss.. Gimme a link to the UI your using :P