hunter mac

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

cerberuss
orc pawn
orc pawn
Posts: 16
Joined: Tue Oct 07, 2003 4:19 pm

hunter mac

Post by cerberuss » Tue Oct 07, 2003 4:26 pm

ok ive been trying to get this hunter mac set up properly so it will hunt shadowed men in lavastorm and loot the essence of shadows but everysingle attempt i make it fails. it cant parse any of the declares and its been drivin me mad all morning any help would be appreciated.

Code: Select all

| hunter.mac 
| v2.0 
| 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 MainArray(1,0) "silk" and /varset MainArray(1,1) "skin" 
| Also edit /varset MainArray(2,0) "widow" and /varset MainArray(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 MainArray(2,0) "widow" 
| /varset MainArray(2,1) "wolf" 
| /varset MainArray(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. 

Sub Main 
   /declare MobToHunt global 
   /declare MainArray array2 
   /declare MyXLOC global 
   /declare MyYLOC global 
   /declare KSRadius global 
   /declare NotSee global 
   /declare TooFar global 
   /declare MyTarget global 
   /declare TargetDead global 
   /declare HasTarget global 
   /declare ObstCount global 
   /declare LootSlot global 
   /declare CheckLoot global 
   /declare LootTotal global 
   /declare MobArraySize global 
   /press esc 
   /press esc 
   /press esc 
   /press esc 
   /press alt 
   /press shift 
   /press ctrl 
   /varset LootSlot 0 
   /varset CheckLoot 0 
   /varset MainArray(1,0) "silk" 
   /varset MainArray(1,1) "quality" 
| Add as many of these  as you want but make sure you 
| increase LootTotal 
   /varset MainArray(2,0) "widow" 
   /varset MainArray(2,1) "wolf" 
| Add as many of these as you want but make sure you 
|  increase MobArraySize 
   /varset LootTotal 2 
   /varset KSRadius 60 
   /varset HasTarget 0 
   /varset ObstCount 0 
   /varset MobArraySize 2 
   /lootn never 
   :Start 
   /call GetTarget 
   /if @HasTarget=="1" /call MoveToMob 
   /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 "@MainArray(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 
   /varset MobToHunt $target(name) 
/return 



sub MoveToMob 
   /delay 2s 
   /varset MyXLOC $char(x) 
   /varset MyYLOC $char(y) 
   /if n $target(distance)<=13 { 
      /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)<=13 { 
      /face fast 
      /sendkey up up 
      /return 
   } 
   /if @ObstCount>=3 { 
      /call CheckObst 
      /goto :Movementloop 
   } 
   /if n $target(distance)>13 /goto :MovementLoop 
   /doability "sneak" 
/return 

sub CombatSub 
   /if $target()=="FALSE" { 
      /varset HasTarget 0 
      /return 
   } 
   /attack on 
   :combatloop 
   /face fast nopredict 
   /if $char(class)==Rogue /call BackstabIt 
   /if n $target(distance)>13 { 
      /sendkey down up 
      /goto :combatloop 
   } 
   /if n $target(distance)<=13 /sendkey up up 
   /face fast nopredict 
   /if n $target(id)==0 /varset TargetDead 1 
   /if n @TargetDead!=1 /goto :combatloop 
   /delay 1s 
   /target corpse @MobToHunt 
   /delay 2s 
/return 

sub LootMob 
   /loot 
   /delay 2s 
   :lootloop 
   /if n @LootSlot>=9 /goto :doneloot 
   /click left corpse @LootSlot 
   /delay 1s 
   /if "$cursor()"!="TRUE" /goto :doneloot 
   :lootChecker 
   /if "$cursor(name)"~~"@MainArray(1,@CheckLoot)" { 
      /delay 1s 
      /click left auto 
      /delay 1s 
      /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 @Param0 
      /sendkey up Right 
      /sendkey down up 
      /delay 3s 
      /sendkey up up 
   } else { 
      /delay 3s 
      /sendkey up down 
      /sendkey down left 
      /delay @Param0 
      /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 BackstabIt 
   /if n $char(ability,"Backstab")!=-2 { 
      /if $target()=="TRUE" { 
         /face fast nopredict 
         /doability "Backstab" 
      } 
   } 
/return
Last edited by cerberuss on Tue Oct 07, 2003 4:49 pm, edited 4 times in total.

Scrime
a ghoul
a ghoul
Posts: 86
Joined: Sun Sep 21, 2003 5:48 pm
Contact:

Post by Scrime » Tue Oct 07, 2003 4:30 pm

If it can't pares the /declares, then it sounds to me like you don't have the MQ with the variable changes. My suggestion: get the newest MQ and recompile.

Also, please use the code tags when posting code. Its very hard to look at code thats not fixed width.

cerberuss
orc pawn
orc pawn
Posts: 16
Joined: Tue Oct 07, 2003 4:19 pm

Post by cerberuss » Tue Oct 07, 2003 5:06 pm

ok i got it to run but its not looting properly where would i add the delay or the search for the corpse?

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Tue Oct 07, 2003 5:24 pm

Tell us more about what goes wrong. Does it go on to the next mob without even trying to find/loot the corpse? Does it move to the corpse but doesn't loot? Does it open the loot window but doesn't loot the items? Does it destroy the wrong stuff? etc...

cerberuss
orc pawn
orc pawn
Posts: 16
Joined: Tue Oct 07, 2003 4:19 pm

Post by cerberuss » Tue Oct 07, 2003 5:54 pm

it will try and find the target's corspe but it cant find it then it goes to the next mob then loses target tells me i need a target to loot then retargets the living target attack and repeat.

cerberuss
orc pawn
orc pawn
Posts: 16
Joined: Tue Oct 07, 2003 4:19 pm

Post by cerberuss » Tue Oct 07, 2003 6:04 pm

ive pretty much gotten it now i just had to add another line telling it to loot the specific mob's corpse
thank you all for the help im pretty sure you all be helping me whith other macro's lol

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Tue Oct 07, 2003 6:08 pm

Try this (changes in red):

Code: Select all

sub GetTarget 
.....
   /varset HasTarget 1 
   /varset MobToHunt $target([color=red]id[/color]) 
/return 

Code: Select all

sub CombatSub 
......
   /target [color=red]id[/color] @MobToHunt 
   /delay 2s 
/return