Hunter.mac

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

funkymunky
decaying skeleton
decaying skeleton
Posts: 4
Joined: Sun Aug 17, 2003 8:32 pm

Hunter.mac

Post by funkymunky » Sun Aug 17, 2003 8:41 pm

Ok, I've closely followed this project for a while now, and have decided to start experimenting with some macros myself. I've taken the code from Grimjack's Hunter script and am having a few troubles. I've read the entire thread, and have changed my TitleBar for my inventory and loot windows to false. I have also made a few modifications as suggested by others on that thread.

I am starting off with this macro, and building on top to make this work specificaly for my monk. The macro kills, and loots just fine, but there are two problems I have here.

First, the macro tends to target mobs from accross the zone - I really dont want it doing that. Ive made changes in KS Radius and such, as a trial and error test, but it still does the same. Is there a way to change this?

Also, the macro loots fine, the only problem is destroying the loot. The cursor is moved about an inch below the destroy button, every time. Any suggestions there? I am using the EQ default UI... I'll post the code below. Thanks all.


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 
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) "substance" 
   /varset LootTotal 1 
   /varset a(2,0) "sonic" 
   /varset a(2,1) "owlbear" 
   /varset KSRadius 10
   /varset HasTarget 0 
   /varset ObstCount 0 
   /varset MobArraySize 2 
   /varset MobDistance 5 
   /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 "$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 
      /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 
       
   /if n $target(distance)>13 { 
      /sendkey down up 
      /goto :combatloop 
   } 
   /if n $target(distance)<=$MobDistance /sendkey up up 
   /face fast nopredict 
   /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 
   /if n $LootSlot==0 /click left corpse $LootSlot 
   /if n $LootSlot==1 /click left corpse $LootSlot 
   /if n $LootSlot==2 /click left corpse $LootSlot
   /if n $LootSlot==3 /click left corpse $LootSlot
   /if n $LootSlot==4 /click left corpse $LootSlot
   /if n $LootSlot==5 /click left corpse $LootSlot
   /if n $LootSlot==6 /click left corpse $LootSlot
   /if n $LootSlot==7 /click left corpse $LootSlot
   /if n $LootSlot==8 /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 

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 » Sun Aug 17, 2003 8:52 pm

If you are using the entire default UI I don't know what could be causing it to click that far off the destroy button.

/puzzle

funkymunky
decaying skeleton
decaying skeleton
Posts: 4
Joined: Sun Aug 17, 2003 8:32 pm

Post by funkymunky » Sun Aug 17, 2003 8:55 pm

Heh yeah... I've even tried moving the destroy button down to where the cursor was stopping, but it seems to always keep about an inch between the button no matter where I place the inventory screen.

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 » Mon Aug 18, 2003 12:06 am

Just a strange idea, but try replacing your loot code with what is in hunter.mac.

If that doesn;t work then it might be easier to track down from there.

boredom
a lesser mummy
a lesser mummy
Posts: 49
Joined: Thu Jun 19, 2003 3:45 pm

how I do pulling (sometimes)

Post by boredom » Mon Aug 18, 2003 11:40 am

here's my pull code, or most of it:

In Main above the main loop:

Code: Select all

	|||||||||||||||  ALERTS for pulling   ||||||||||||||||||
	/alert clear 1
	/alert add 1 npc radius 200 drakkel
	/alert clear 2
	/alert add 2 npc radius 400 drakkel
	/alert clear 3
	/alert add 3 npc radius 600 drakkel


	/alert clear 4
	/alert add 4 npc radius 200 giant
	/alert clear 5
	/alert add 5 npc radius 400 giant	
	/alert clear 6
	/alert add 6 npc radius 600 giant
in the main loop:

Code: Select all

	/call PullSub
other subs:

Code: Select all

Sub PullSub
	/if n $PullTimer>0 /return
	/if $alert(1)==TRUE {
		
		/target npc radius 200 drakkel
		/call PullIt
		/return
	}
	/if $alert(4)==TRUE {
		/target npc radius 200 giant
		/call PullIt
		/return
	}
	/if $alert(2)==TRUE {
		/target npc radius 400 drakkel
		/call PullIt
		/return
	}
	/if $alert(5)==TRUE {
		/target npc radius 400 giant
		/call PullIt
		/return
	}
|**	/if $alert(3)==TRUE {
		/target npc radius 600 drakkel
		/call PullIt
		/return
	}
	/if $alert(6)==TRUE {
		/target npc radius 600 giant
		/call PullIt
		/return
	}
**|
/return

Sub PullIt
	/if n $target(hp,cur)<100 /return
	/call GoToIt 150
	/delay 10
	/call SpellSub "SlowSpell"
	/call DoPossition
	/varset PullTimer 20s
	/varset SitTimer 20s
/return

Sub GoToIt
	/if $char(state)!=STAND /stand 
	/varset countdown 0 
	/varset MyXLoc $char(x) 
	/varset MyYLoc $char(y)
	/if n $strlen("$p0")<=0 {
		/varset l0 15
	} else {
		/varset l0 $p0
	:gotopointloop 
	/doevents 
	/if $target()==FALSE { 
		/sendkey up up 
		/return 
	} 
	/face fast nopredict 
	/if n $target(distance)>$l0 /sendkey down up 
	/if n $target(distance)<=$l0 { 
		/sendkey up up 
		/return 
	} 
	/face fast nopredict 
	/if n $countdown>=3 { 
		/call Detectobst 
		/varset countdown 0 
	} 
	/varadd countdown 1 
	/doevents 
	/goto :gotopointloop 
	/sendkey up up 
	/face
/return

Sub DoPossition
	/if n $distance(LOCATION)>30 {
		/varset countdown 0
		/face loc LOCATION
		/sendkey down up
		:ForwardLoop
		/doevents
		/face loc LOCATION
		/if n $distance(LOCATION)<5 {
			/sendkey up up
			/delay 10
			/return
		}
		/if n $countdown>=3 { 
			/call Detectobst 
			/varset countdown 0 
		}
		/goto :ForwardLoop
	}
/return
I'm sure there is a much more eligant way to do this using loops and arrays, but that's not the way I did it.