Rogue Assist Macro

Got a cool macro idea? Wanna request a macro? Here is the place for you!

Moderator: MacroQuest Developers

Casty
decaying skeleton
decaying skeleton
Posts: 8
Joined: Tue Feb 10, 2004 4:18 pm

Rogue Assist Macro

Post by Casty » Sun Feb 22, 2004 2:46 pm

I'm having some trouble with my rogue assist macro (a lot of problems actually). The more and more I try to fix the code, the worse it seems to get.

Basically, what I want this macro to do is assist the MA (specified in the beginning (ie. /mac rogue John)), check if the mob is indeed an NPC, if it is movebehind the mob, backstab and evade everytime they are up. I also want it to reassist MA every 6 seconds just in case the ma has switched targets.

The code I have atm is:

Code: Select all

|Rogue Macro v. 1.0
|Rogue Assist Macro
|Code taken from Gellenole's Autofire Archery Macro and GrimJack's Genbot
|All credit goes to them
|Usage: /Macro Rogue <tank name> 
|
|----------------------------------------------------------------------------| 
#Event SlainBy "You have been slain by"
#Event Enraged "has become ENRAGED"
#Event Offrage "is no longer enraged"

#turbo infinite 

Sub Main 
   /ECHO =+= Usage: /Macro Rogue <Tank name> =+= 
   /declare tankname global
   /declare countdown global
   /declare MyXLoc global 
   /declare MyYLoc global
   /declare Combatstatus global 
   /varset tankname @Param0

   :Mainloop 
   /call Combatcheck 
   /if @combatstatus=="1" /call Movebehind
   /if @combatstatus=="1" /call Backstab
   /if @combatstatus=="1" /call Evade
   /doevents 
   /goto :mainloop 
/return 

| --> This sub command is a switch to check for mob target 
Sub Combatcheck 
/Echo Your Main Assist is @tankname 
:stop 
/doevents 
/assist @tankname 
/delay 15 
/if "$target(type)"=="NPC" { 
/Echo Autoattack Engaged
/attack on
/call Movebehind

} 

/if "$target(type)"!="NPC" { 
/delay 10 
/goto :stop
} 

/if "$target()"=="FALSE" { 
/delay 5 
/goto :stop
} 

/return 

| Move Behind
Sub Movebehind
   /varset countdown 0 
   /varset MyXLoc $char(x) 
   /varset MyYLoc $char(y) 
   /varset Combatstatus 1 
   /if $target()==FALSE { 
      /assist @MasterName 
      /call Delay 5 
   } 
   /if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))<3 /goto :noneed 
   /if $target()==FALSE /return 
   /sendkey down up 
   :gobehindloop 
   /if $target()==FALSE { 
      /sendkey up up 
      /return 
   } 
   /if n @countdown>=20 { 
      /if n @MyXLoc==$char(x) { 
         /if @MyYLoc==$char(y) { 
            /sendkey up up 
            /return 
         } 
      } 
      /varset MyXLoc $char(x) 
      /varset MyYLoc $char(y) 
      /varset countdown 0 
   } 
   /varadd countdown 1 
   /doevents 
   /if "$char(state)"=="SIT" /stand 
   /face nolook fast loc $calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10) 
   /if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))>1 /goto :gobehindloop 
   /sendkey up up 
   /if "$char(state)"=="SIT" /stand 
   /face fast 
:noneed
/return

Sub Backstab
/if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))<9 { 
   /if "$char(state)"=="SIT" /stand 
      /face fast 
      /call Delay 3 
      /doability "Backstab"
   }
}
/return

Sub Evade
/if n $char(ability,"Hide")>0 { 
   /attack off 
   /doability "Hide" 
   /attack on 
} 
/return 

/if "$target(type)"!="NPC" { 
/delay 10 
/call Combatcheck 
} 

/if "$target()"=="FALSE" { 
/delay 5 
/call Combatcheck 
} 

/return

Sub Delay(DelayTime) 
     /delay @DelayTime 
/return 

Sub Event_SlainBy
/Echo Slained Event Entered
/endmacro
/return

Sub_Event_Enraged
/attack off
/return

Sub_Event_Offrage
/attack on
/return
Thanks in advance.

Gumby
a ghoul
a ghoul
Posts: 99
Joined: Sat Jan 24, 2004 5:27 pm

Post by Gumby » Sun Feb 22, 2004 3:52 pm

Would help if you posted what trouble you're having.

Lot quicker for readers here to assist you if we don't have to line by line go through every step of the code. I at least, don't have the time to throughly screen it, maybe someone else does but it's extra effort that shouldn't be required :).

G

Casty
decaying skeleton
decaying skeleton
Posts: 8
Joined: Tue Feb 10, 2004 4:18 pm

Post by Casty » Mon Feb 23, 2004 10:09 pm

Currently, the macro does indeed go behind the mob and begin attacking; however, it does NOT backstab or evade. I'm not sure what's wrong exactly. Also, i'm not exactly sure where or what I need to do to make sure it reassists every 6 seconds.

That's the problem.

Thanks in advance

daerck
a ghoul
a ghoul
Posts: 134
Joined: Mon Jan 12, 2004 8:44 pm

Post by daerck » Mon Feb 23, 2004 10:41 pm

Hmm. I haven't tested this in game but here are some things you should look at.

You never set the @combatstatus var and the Movebehind part is called from your Combatcheck sub.
You want to rewrite the Combatcheck sub to only /assist and then set the @combatstatus to 1 or 0 depending on having a valid target or not, and not doing anything else.

Also, you have some code fragments between the Sub Evade and Sub Delay that have no use / aren't part of the macro. Oh and regarding the Sub Delay: Why?

Casty
decaying skeleton
decaying skeleton
Posts: 8
Joined: Tue Feb 10, 2004 4:18 pm

Post by Casty » Mon Mar 01, 2004 1:42 am

I changed the code around. I seem to keep making it worse. I added the @combatstatus var and cleaned it up a bit (i think). Like I said before, I'm not a programmer. I'm just trying to piece it together and it's getting worse i think. Any help would be appreciated.

Here's the current version (which turns on auto attack and doesn't move, but doesn't move behind, nor bs, nor evade, and spams "Your Main Assist is Blah" and "Autoattack Engaged."):

Code: Select all

|Rogue Macro v. 1.0
|Rogue Assist Macro
|Code taken from Gellenole's Autofire Archery Macro and GrimJack's Genbot
|All credit goes to them
|
|Assist MA, move behind, auto backstab, auto evade
|reassist MA every 6 seconds
| 
|Usage: /Macro Rogue <tank name> 
|
|----------------------------------------------------------------------------| 
#Event SlainBy "You have been slain by"
#Event Enraged "has become ENRAGED"
#Event Offrage "is no longer enraged"

#turbo infinite 

Sub Main 
   /ECHO =+= Usage: /Macro Rogue <Tank name> =+= 
   /declare tankname global
   /declare countdown global
   /declare MyXLoc global 
   /declare MyYLoc global
   /declare Combatstatus global 
   /varset tankname @Param0

   :Mainloop 
   /call Combatcheck
   /Echo Autoattack Engaged
   /attack on
   /if @combatstatus=="1" /call Movebehind
   /if @combatstatus=="1" /call Backstab
   /if @combatstatus=="1" /call Evade
   /doevents 
   /goto :mainloop 
/return 

| --> This sub command is a switch to check for mob target 
Sub Combatcheck 
/Echo Your Main Assist is @tankname 
:stop 
/doevents 
/assist @tankname 
/delay 15 
/if "$target(type)"=="NPC" { 
/varset Combatstatus 1

} 

/if "$target(type)"!="NPC" { 
/delay 10 
/varset Combatstatus 0
/goto :stop
} 

/if "$target()"=="FALSE" { 
/delay 5 
/varset Combatstatus 0
/goto :stop
} 

/return 

| Move Behind
Sub Movebehind
   /varset countdown 0 
   /varset MyXLoc $char(x) 
   /varset MyYLoc $char(y) 
   /varset Combatstatus 1 
   /if $target()==FALSE { 
      /assist @MasterName 
      /delay 50 
   } 
   /if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))<3 /goto :noneed 
   /if $target()==FALSE /return 
   /sendkey down up 
   :gobehindloop 
   /if $target()==FALSE { 
      /sendkey up up 
      /return 
   } 
   /if n @countdown>=20 { 
      /if n @MyXLoc==$char(x) { 
         /if @MyYLoc==$char(y) { 
            /sendkey up up 
            /return 
         } 
      } 
      /varset MyXLoc $char(x) 
      /varset MyYLoc $char(y) 
      /varset countdown 0 
   } 
   /varadd countdown 1 
   /doevents 
   /if "$char(state)"=="SIT" /stand 
   /face nolook fast loc $calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10) 
   /if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))>1 /goto :gobehindloop 
   /sendkey up up 
   /if "$char(state)"=="SIT" /stand 
   /face fast 
:noneed
/return

Sub Backstab
/if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))<9 { 
   /if "$char(state)"=="SIT" /stand 
      /face fast 
      /delay 30 
      /doability "Backstab"
   }
}
/return

Sub Evade
/if n $char(ability,"Hide")>0 { 
   /attack off 
   /doability "Hide" 
   /attack on 
} 
/return 

Sub Event_SlainBy
/Echo Slained Event Entered
/endmacro
/return

Sub_Event_Enraged
/attack off
/return

Sub_Event_Offrage
/attack on
/return

Gumby
a ghoul
a ghoul
Posts: 99
Joined: Sat Jan 24, 2004 5:27 pm

Post by Gumby » Mon Mar 01, 2004 11:32 am

Variables are case-senstive. Also, if using numeric comparisons, /if n is a much better way of doing it... even if on equivalence checks, should in theory be no difference.

Code: Select all

/if @combatstatus=="1"
Should be:

Code: Select all

/if n @Combatstatus==1
In your main loop you /echo and /attack on; these two functions will get called over and over again (/attack on /shrug, but the /echo is why you keep getting spammed).

If it were me, I'd probably move it to your Combat check subroutine, and redo the first check something along the lines of:

Code: Select all

/if n @Combatstatus==0 /if "$target(type)"=="NPC" { 
   /varset Combatstatus 1 
   /Echo Autoattack Engaged 
   /attack on 
} 
This prevents the sequence from getting called over and over while you're attacking on target.

The two fixes should clean up the errors you posted regarding.

G