My rogue script.

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

My rogue script.

Post by grimjack » Tue May 20, 2003 10:37 am

Was the first script I ever started. It has evolved a lot over time and now is now where I want it. The coments will explain. Thanks to all for your scripts in the depot and for the great documentation in the forums.

Code: Select all

| rogue.mac
| Grimjack's Rogue helper scripts for 2 boxing.
| Many pieces are pulled from the macro depot on macroquest2.com
| with some modifications.  I would like to thank all the authors who's code I used 
| to complete this.
| This particular script is designed to be used in tandem with my getbehind script.
| I use this script to auto evade, move to mob, and backstab when the mob's back is facing me.
| Originaly I had the script automaticly moving behind the mobs but when you get aggro it can
| Look really wierd.
| This is designed to be an always on script.  It will automaticly move to the mob that you have 
| targeted when you turn on attack. It will also auto evade, turn off/on attack for enrage, 
| and backstab when mob is in correct position.
|
| The healthcheck sub is designed to use my click heal bp when I am not attacking and below 
| 90 health and have no target. 0 is the key pressed to activate the
| hotkey my BP slot is in.
|
| If there are any improvments that you see can be made let me know please.
| useage:
|/macro rogue.mac [minimum distance to mob] [maximum distance to mob] [distance at which to move fast]


#define RangeMin v50
#define RangeMax v51
#define FastRange v52
#Turbo 72
#define Combatstatus v60
#define CastTimer t1
#define EnrageVar v61
#Event Enraged "has become ENRAGED" 
#Event Offrage "is no longer enraged"

Sub Main
   /varset RangeMin $p0
   /varset RangeMax $p1
   /varset FastRange $p2
   /varset Combatstatus 0
   /varset EnrageVar 0
   :Mainloop
   /call Combatcheck
   /if $Combatstatus=="1" /call RangeSub
   /if $Combatstatus=="1" /call Checkbehind
   /if $Combatstatus=="1" /call Evadeit
   /if $Combatstatus=="1" /call Checkbehind
   /if $Combatstatus=="0" /call Healthcheck
   /doevents
   /goto :Mainloop
/return





Sub Healthcheck
   /if n $CastTimer>0 /return
   /if n $char(hp,pct)<90 {
      /if $combat!="TRUE" {
         /if $target()=="FALSE" {
            /press 0
            /varset CastTimer 16s
         }
      }
   }
/return



Sub Checkbehind
   /if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))<8 {
      /if $Combatstatus=="1" /call Backstabit
   }
/return


Sub Evadeit
   /if n $char(ability,"Hide")!=-2 {
      /if $Combatstatus=="1" {
         /attack off
         /doability "Hide"
         /if $EnrageVar!="1" /attack
      }
   }   
/return


Sub Backstabit
   /if n $char(ability,"Backstab")!=-2 {
      /if $target()=="TRUE" {
         /face fast nopredict
         /doability "Backstab"
      }
   }
/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
   }
   /if $target()=="TRUE" {
      /if $combat=="TRUE" {
         /varset Combatstatus 1
         /return
      }
   }
/varset Combatstatus 0
/return



Sub Rangesub
   /face fast nopredict
   /if n $target(distance)>=$FastRange /call Fastmove
   /if n $target(distance)>$RangeMax {
      /press up
   }
   /if n $target(distance)<$RangeMin {
      /press down
   }
/return


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

Sub Fastmove
   :fastmoveloop
   /if $target()=="FALSE" {
      /varset Combatstatus 0
      /sendkey up up
      /if $combat=="TRUE" {
         /attack off
         /return
      }
   }
   /face fast nopredict
   /if n $target(distance)>$FastRange {
      /sendkey down up
      /attack off
   }
   /if n $target(distance)<=$FastRange {
         /if $Combatstatus=="1" {
            /if $EnrageVar=="0" {
               /attack on
            }
         }
      /sendkey up up
      /return
   }
   /goto :fastmoveloop
/return


Sub Event_Offrage
   /if $target()=="TRUE" {
         /varset EnrageVar 0
         /attack
      }
   }
/return
Last edited by grimjack on Tue May 20, 2003 12:21 pm, edited 4 times in total.

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

My get behind script.

Post by grimjack » Tue May 20, 2003 10:50 am

I call this from another hotkey(bound to one of my mouse buttons). This takes the same arguments as the last script. It calls the last script once finished.

Edit 6/05. Added the #define statements that where missed when posting this code. This should fix many of the errors people have.

Code: Select all

| movebehind.mac
| moves you behind current target and faces.
| Many parts where or are taken from macroquest2.com in the 
| macro depot
| useage:
| /macro movebehind.mac [range] [range] [range]
| The range statements are the same as the rogue script.
#define RangeMin v70
#define RangeMax v71
#define FastRange v72
Sub Main
   /varset RangeMin $p0
   /varset RangeMax $p1
   /varset FastRange $p2
   /attack off  
   /if $target()==FALSE { 
      /attack off
      /sendkey up up
      /macro newone $RangeMin $RangeMax $FastRange
   } 
   /if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))<3 /goto :noneed
   /sendkey down up
   :gotopointloop 
   /if $combat=="TRUE" /attack off
   /if $target()==FALSE { 
      /attack off
      /sendkey up up
      /macro newone $RangeMin $RangeMax $FastRange
   } 
   /face 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 :gotopointloop 
   /sendkey up up 
   /face fast nopredict
:noneed
/attack on
/macro rogue $RangeMin $RangeMax $FastRange
/return
Last edited by grimjack on Thu Jun 05, 2003 3:53 am, edited 1 time in total.

Losingteam
a lesser mummy
a lesser mummy
Posts: 75
Joined: Wed May 21, 2003 8:52 pm
Location: Chicago,Illinois

Post by Losingteam » Tue Jun 03, 2003 11:01 pm

Just wondering what you set your 3 ranges for? I dont know what umbers would be appropriate for this.

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Tue Jun 03, 2003 11:37 pm

Losingteam wrote:Just wondering what you set your 3 ranges for? I dont know what umbers would be appropriate for this.
The first range is the minimum distance you want your char to be away from the mob. I change this often depending on what I am doing. It usualy hovers from 10-16 for me. The second is the maximum range you would like to be from the mob. Usualy 2-3 higher than the minimum. But if you don't want it to adjust so much you can make the gap bigger. The third range is the range which it turns off attack while moving. Used for when the char has to move long distances to get to the mob. I usualy make this around 20-30.

Common numbers for me is: 10 12 20, 14 17 25, 16 18 25. Really you will have to play with it a bit to see how your character acts. On fast machines it will act different than on slow machines. The only reasons I don't hardcode this is switching from max melee for rooted mobs, some biger mobs have a larger distance you can attack from, and tweaking on other machines so you don't overrun/underrun mobs.

I hope this explains it good enough.

Thanks
GrimJack

Losingteam
a lesser mummy
a lesser mummy
Posts: 75
Joined: Wed May 21, 2003 8:52 pm
Location: Chicago,Illinois

Post by Losingteam » Wed Jun 04, 2003 2:11 pm

You explained it perfectly. I actually set mine to stupid numbers and then had to play with it a bit. My numbers are still wrong and will have to fix them after reading this post. Thanks Grim

Hanyabull
decaying skeleton
decaying skeleton
Posts: 1
Joined: Wed Jun 04, 2003 9:05 pm
Location: N/A
Contact:

Problems running this Rogue Script

Post by Hanyabull » Wed Jun 04, 2003 9:15 pm

Hey all, first time posting here, and i have a couple of questions to ask about this Rogue script.

Pretty much, i got the Backstab/Hide/Sneak scripts working fine. My problem is running the movebehind script.

Grimjack has posted saying they work in tandem, but im not sure how to do that. Also, when i tried running the movebehind script by itself, i got the 3 varset errors, even tho i provided the values.

Example:

/macro movebehind 16 18 25

and it goes all crazy on me.

Im very new to macroquest so there is a good chance im not understanding something that is very trivial. Any help will be greatly appreciated.

Losingteam
a lesser mummy
a lesser mummy
Posts: 75
Joined: Wed May 21, 2003 8:52 pm
Location: Chicago,Illinois

Post by Losingteam » Wed Jun 04, 2003 10:34 pm

Apparantly we are both doing the second macro wrong. Or maybe the macro has a problem in it. I run the first macro as /macro rogue.mac 10 12 20...then I pop the second macro on while Iwas fighting as /macro movebehind.mac 10 12 20. I am alright as long as I only run the rogue.mac. Once I use the movebehind.mac I start running 'circles' around the mob and my rogue goes nuts. I even had one group member say, "What the hell is he doing running around like that." So for now I have decided to run the rogue.mac because it works fine, and then hope maybe there is something I am missing in the movebehind.mac that I can fix.


PS. I also tried running just the movebehind.mac without the rogue.mac and the sam issue still occurs.

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Wed Jun 04, 2003 11:14 pm

Salutations,
This macro is sold old it's funny, so I don't gaurentee that it works, but here it is. If you find it useful I'll go fix it.

Code: Select all

| backstab.mac
| Written by L124RD
| Takes no arguments
#event attackingme "YOU for "
#event attackingme "YOU but "

sub main
 /stand
 /assist $p0
 /g Assisting $p0...
 /varset a(0,0) $target(id)
 /varset a(0,1) 1
 /varset a(2,0) $p1
 /if "$p2"!="" /varset a(2,1) $p2
 :loop
  /if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))>5 /call gotopoint
  /face
  /if n $a(0,1)==1 {
   /varset a(0,1) 0
   /attack off
   /doability 7
   /doability 1
   /attack on
   /varset t0 10s
  }
  /if n $t0==0 {
   /attack off
   /doability 7
   /doability 1
   /attack on
   /varset t0 10s
  }
  /if $combat==FALSE /call sitdown
  /if $target()==FALSE /call sitdown
 /goto :loop
/return

sub gotopoint
 /sendkey down up
 :gotopointloop
  /if $combat==FALSE /call sitdown
  /if $target()==FALSE /call sitdown
  /face fast loc $calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10)
  /doevents
  /if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))>5 /goto :gotopointloop
 /sendkey up up
/return

sub sitdown
 /sendkey up up
 /attack off
 /if n $a(2,0)==0 /endmacro
 /face loc $a(2,0)
 /sendkey down up
 :sitdownloop
  /face fast loc $a(2,0)
  /doevents
  /if n $distance($a(2,0))>3 /goto :sitdownloop
  /sendkey up up
 /face loc $a(2,1)
 /sit
 /endmacro
/return

sub event_attackingme
 /endmacro
/return

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Thu Jun 05, 2003 3:45 am

Losingteam wrote:Apparantly we are both doing the second macro wrong. Or maybe the macro has a problem in it. I run the first macro as /macro rogue.mac 10 12 20...then I pop the second macro on while Iwas fighting as /macro movebehind.mac 10 12 20. I am alright as long as I only run the rogue.mac. Once I use the movebehind.mac I start running 'circles' around the mob and my rogue goes nuts. I even had one group member say, "What the hell is he doing running around like that." So for now I have decided to run the rogue.mac because it works fine, and then hope maybe there is something I am missing in the movebehind.mac that I can fix.


PS. I also tried running just the movebehind.mac without the rogue.mac and the sam issue still occurs.
You did this correct. I'll check what I use at home to make sure what I posted is the current one. Basicly it works like this. I have the get behind script I launch when I want to get behind a mob. If you have agro when you do this it will with out bigtime. The mob will turn and face you as you try to get behind it and you bounce all over the place. Another thing that can make movement screwy is your machine speed. The values I use for when I want macroquest to release the up key and what you should use may be different based on how fast your machine reacts. The variables for the second script do not affect it in any way. They are just there to be passed to the first script. Basicly if you run the getbehind script it calls the other script when it's done with those variables.

Here is how I use the scripts. I have the main one running at all times. It will move me into combat backstab ect ect when I have a target and turn on attack. When I decide I need to move behind the mob I hit the other script which moves me behind the mob and calls the original script.

Here are some things you can play with.


Code: Select all

$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 :gotopointloop
Change the >1 to a larger value like this

Code: Select all

$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))>5 /goto :gotopointloop
My machine reacts very fast so >1 works for me. On a slower machine however it may not react as fast and you will over-run your mark.

And one last time I'll repeat don't start the getbehind script if you have aggro, it WILL wig out. Try testing on your other char or someone afk before using it in a real fight as well. I usualy place my rogue in front of my other char select him and hit the getbehind script to test it. I have these both set up to hotkeys and the getbehind is bound to a mouse button.

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

My bad.

Post by grimjack » Thu Jun 05, 2003 3:58 am

Ok I just noticed that when I copy and pasted the code I missed my #define's

The movebehind script I posted is now fixed and I would update the one you have with it.

Code: Select all

#define RangeMin v70
#define RangeMax v71
#define FastRange v72 
The above was missing. This caused your movebehind to work most likely but when it was starting the main rogue script it was giving no variables causeing the min max and fast ranges to be null. I am sure this would cause some very very odd movement issues. Try to run with the new code and let me know how it goes. I would test on one of your other char's if you 2box before using in a fight.

Thanks
GrimJack