ATK.mac Auto attack macro.

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

ATK.mac Auto attack macro.

Post by loadingpleasewait » Wed Oct 08, 2003 2:37 pm

Can follow, taunt, kick, face, disarm, watch for enrage, and not spam while casting.

I know its ugly, but hey, it works..

Code: Select all

|atk.mac Auto-Attack Macro for everyday use.
|Mashed together from other assorted macros.
|has the ability to toggle taunting, and autofollowing
|for those situations wher you jusnt might not want ta
|follow that mob.
|
|Usage: 
|/macro atk.mac follow taunt (to follow and taunt)
|/macro atk.mac follow (to just follow)
|/macro atk.mac taunt (to just taunt)
|/macro atk.mac (to neither taunt nor follow)
#Event exp "experience!"
#Event Casting "You begin casting"
#Event Enraged "has become ENRAGED" 
#Event Offrage "is no longer enraged" 

Sub Main(FirstArg,SecondArg)
   /echo "Auto-Attack Macro has begun."
   /declare Toggle local 
   /declare Toggle2 local 
   /declare startexp global
   /declare startaaxp global
   /declare EnrageVar global 
   /declare Combatstatus global
   /declare currentxp global
   /declare xpgain global
   /declare currentaa global
   /declare aagain global 
   /declare taunttoggle global
   /declare followtoggle global
   /declare targetarray array 

   /varset Toggle @FirstArg 
   /varset Toggle2 @SecondArg 
   /varset startexp $char(exp)
   /varset startaaxp $char(aa,exp)

/if "@Toggle"=="Follow" {
   /echo "Auto-Follow enabled"
   /varset "followtoggle" 1
   }
/if "@Toggle2"=="taunt" {
   /echo "Auto-Taunt enabled"
   /varset "taunttoggle" 1
   }
/if "@Toggle"=="taunt" {
   /echo "Auto-Taunt enabled"
   /varset "taunttoggle" 1
   }

      :mainloop
         /if "$combat"=="TRUE" /call melee
         /delay 3
         /doevents
      /goto :mainloop
/return

Sub melee
  
  /varset targetarray(0) "$target(name,clean)" 
  /varset targetarray(1) $target(level) 
  /varset targetarray(2) $target(name) 
  /varset targetarray(3) $target(id) 
  
  /delay 3
  /if "@targetarray(3)"=="0" /return
  /if "$combat"!="TRUE" /return

  /echo Fighting a level @targetarray(1) @targetarray(0) 
  /face nopredict 
  /varset Combatstatus 1

  :CloserAF 
    /if "$target(id)"!=@targetarray(3) /goto :EndAF 
    /doevents
    /call Combatcheck
    /if "@followtoggle"==1 {
    /if n $target(distance,nopredict)>25 /sendkey down up
    /if n $target(distance,nopredict)>10 /if n $target(distance,nopredict)<25 {
    /press Num_9
    /delay 3
    /sendkey down up 
    /press Num_9
    }
    /if n $target(distance,nopredict)<10 /sendkey up up
    )
    /face fast nopredict 
    /if n $target(distance,nopredict)<11 /if n $char(ability,"Kick")>0 /doability "Kick" 
    /if n $target(distance,nopredict)<11 /if n $char(ability,"Disarm")>0 /doability "Disarm" 
[color=red]|here it doesnt want to taunt if I do a "/if n $char(ability,"Taunt")>0 statement, dont know why, so I just left that out.[/color]
    /if "@taunttoggle"==1 /doability taunt
    /delay 4
    /goto :CloserAF 
/return

:EndAF 
    /echo The level @targetarray(1) @targetarray(0) is dead... 
    /sendkey up up 
    /sendkey up down 
    /attack off 
    /varset Combatstatus 0
    /varset targetarray(3) 0 
    /press Num_5 
    /delay 4
/return 

Sub AF
    /if n $target(distance,nopredict)>25 /sendkey down up
    /if n $target(distance,nopredict)>10 /if n $target(distance,nopredict)<25 {
    /press Num_9
    /delay 3
    /sendkey down up 
    /press Num_9
    }
    /if n $target(distance,nopredict)<10 /sendkey up up
/return

Sub Combatcheck 
   /if @EnrageVar=="1" { 
      /if $target()=="TRUE" { 
         /return 
      } else { 
         /varset EnrageVar 0 
         /varset Combatstatus 0 
      } 
   } 
   /if $target()=="FALSE" { 
      /varset Combatstatus 0 
      /if $combat=="TRUE" { 
         /attack off 
      } 
      /return 
   } 
/return 

Sub Event_Enraged 
   /if $target()=="TRUE" { 
      /if n @Combatstatus==1 { 
         /varset EnrageVar 1 
         /attack off 
      } 
      /varset EnrageVar 1 
   } 
/return 

Sub Event_Offrage 
   /if $target()=="TRUE" { 
      /if n @Combatstatus==1 { 
         /varset EnrageVar 0 
         /attack 
      } 
      /varset EnrageVar 0 
   } 
/return 

Sub Event_exp
   /varset currentxp $char(exp)
   /varcalc xpgain @currentxp-@startexp
   /varset currentaa $char(aa,exp)
   /varcalc aagain @currentaa-@startaaxp
      /echo "You've gained @xpgain% xp and @currentaa% aaxp."
   /varset @startexp $char(exp)
   /varset startaaxp $char(aa,exp)
/return

Sub Casting
   :checkcast 
    /delay 3 
    /if "$char(casting)"=="TRUE" goto :checkcast 
/return 
LOADING PLEASE WAIT...

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

Post by Mckorr » Wed Oct 08, 2003 2:44 pm

Hmmm, looks familiar :)

btw, Using /sendkey to keep yourself in optimal range results in bouncing back and forth. /press up and /press down makes small adjustments... too small at times, but you don't charge up to the mob, fight for a sec, then charge backwards. It's why I replaced /sendkey with /press to begin with. If you have SoW it's especially noticeable.

Like the events! Will have to incorporate those into my own script, especially the casting part.
MQ2: Think of it as Evolution in action.

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Wed Oct 08, 2003 2:46 pm

Oh, I should have explained.. I mapped Num_9 to toggle run/walk.. when I'm far away from the mob I run, but when I get close, the macro toggles it to walk, which avoids the bobbing motion.. :lol:
LOADING PLEASE WAIT...

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Thu Oct 09, 2003 1:32 am

The gained experience gained display isnt working correctly. I think I'm missing somthing on how /varcalk works now.. basically, i set start exp variable at the begining of the macro. then when experience is gained, I subtract the start exp from the new current exp. BUT, its not working.

could someone tell me how to do this.. current code is this

Code: Select all

  /declare targetarray array 

   /varset Toggle @FirstArg 
   /varset Toggle2 @SecondArg 
   /varset startexp $char(exp) 
   /varset startaaxp $char(aa,exp) 

and then

Code: Select all

Sub Event_exp 
   /varset currentxp $char(exp) 
   /varcalc xpgain @currentxp-@startexp 
   /varset currentaa $char(aa,exp) 
   /varcalc aagain @currentaa-@startaaxp 
      /echo "You've gained @xpgain% xp and @currentaa% aaxp." 
   /varset @startexp $char(exp) 
   /varset startaaxp $char(aa,exp) 
/return 
you can see the varcalc, which is writen. How SHOULD it be written?
LOADING PLEASE WAIT...