Help with hunter.mac

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

Moderator: MacroQuest Developers

Trixz
a lesser mummy
a lesser mummy
Posts: 35
Joined: Mon Apr 21, 2003 8:18 am

Help with hunter.mac

Post by Trixz » Fri Jul 11, 2003 5:58 pm

I am using Grimjack's hunter.mac. I'm mostly wondering if its possible for it to loot because for me its going to the loot screen then sitting for about 5 seconds and then it gets out of the loot screen and continues to kill things. Also after that is taken care of I'm gonna have it do something when you get low on hp and when something other than what you have setup to fight agroes you (skele for example). Does anyone have any code like that they care to share?, If not I'm sure I can write it myself... just checking... maybe save some time.

7/13/03
Macro will now loot your corpse before it starts if you have one

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) "chips" 
   /varset a(1,1) "pelt" 
   /varset LootTotal 2 
   /varset a(2,0) "skeleton" 
   /varset a(2,1) "rodent" 
   /varset KSRadius 60 
   /varset HasTarget 0 
   /varset ObstCount 0 
   /varset MobArraySize 2 
   /varset MobDistance 14 
   /delay 1s 
   /lootn never 
   :Start
   /target mycorpse
  /if n $target(id)!=0 /call lootself 
   /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 lootself   
   /call movetomob
   /loot 
   /delay 2s
   :lootloop 
   /click left corpse $LootSlot
   /varadd LootSlot 1 
   /delay 2s 
   /if "$cursor()"!="TRUE" /goto :doneloot
  :lootChecker 
      /delay 2s 
      /click left auto 
      /goto :lootloop 
   :doneloot
    /varset LootSlot 0
    /click left corpse done
    /delay 1s
    /target mycorpse
   /if n $target(id)!=0 /call lootself
    /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 
   |-----------------------------------------------------------------------/call BackstabIt --------------------------------------------------------------------------------------------------------------
   /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 
   /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 BackstabIt 
   /if n $char(ability,"Backstab")!=-2 { 
      /if $target()=="TRUE" { 
         /face fast nopredict 
         /doability "Backstab" 
      } 
   } 
/return
Last edited by Trixz on Sun Jul 13, 2003 7:50 pm, edited 2 times in total.

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

Post by somemage » Fri Jul 11, 2003 6:12 pm

To get it to loot, you need to change:

Code: Select all

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

Code: Select all

   :lootloop
   /click left corpse $LootSlot
   /if n $LootSlot==9 /goto :doneloot

Trixz
a lesser mummy
a lesser mummy
Posts: 35
Joined: Mon Apr 21, 2003 8:18 am

Things to add to this script

Post by Trixz » Sat Jul 12, 2003 12:29 am

I will be adding a few things to this script to make it work a little better. If anyone has any of these things written in another macro that they care to contribute that would be great... I will update this post as I finish these things.

Updates will be:

- Search for own corpse at start of macro
- Run away/Heal up when low on hp
- Deal with mobs that agro (fight or run)
- Tweak the way movement is done a little... it seems to get hung up occasionally
- Add other tank abilities (monk kicks and such)
- Add caster support

This is probly going to take awhile but I think most of the script can be borrowed from other scripts.

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

Post by Mckorr » Sat Jul 12, 2003 10:54 am

Your syntax for /click is wrong. That was written before Shark fixed things. It's now /click left corpse 0, /click left corpse 1, etc.
MQ2: Think of it as Evolution in action.

Trixz
a lesser mummy
a lesser mummy
Posts: 35
Joined: Mon Apr 21, 2003 8:18 am

re

Post by Trixz » Sat Jul 12, 2003 5:03 pm

Yeah I changed the click syntax just havent updated script yet... I will after I put in search for your own corpse at start which will probly be later today.