Jay Script Libiary - Auto Rogue Script V1.04

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

Moderator: MacroQuest Developers

Jay
a lesser mummy
a lesser mummy
Posts: 59
Joined: Tue Jan 28, 2003 11:37 am

Jay Script Libiary - Auto Rogue Script V1.04

Post by Jay » Mon May 19, 2003 8:02 pm

Here I give this to the community, enjoy!

Release notes:

This script allows a rogue to auto-fight. This is a subscript of a much largest script, the only items being taken out are the "command" controls. If there are any issues, please post them here.

Jay

Code: Select all

| Auto Rogue Script
| Program by Jay
|
| Version 1.04   05/19/2003 
|
| Usage: /macro autorogue <Tank Name>
| 
| Changes for 1.02
| 	- Added Sneakhide option
|	- Added BehindTarget check during enrage
|       - Added enrage var
|   	- Added documentation
|	- Changed, You will not evade when mob is below 20%
| Changes for 1.03
| 	- Added target engage delay
|	- Added target range check before engage
|	- Checks to make sure target is not a pet first
|       - Added an assist in the attack loop
| Changes for 1.04
|       - Added death check

#Event Enraged "has become ENRAGED" 
#Event Offrage "is no longer enraged" 
#Event Slainby "You have been slain by a" 

| ----- Trigger Defines ---------------------
#Define ASSISTHEALTH    97      | Wait until mob is below this health trigger.
#Define EVADEREFRESH    105     | How long it takes till evade refreshes.
#Define TURBOAMOUNT     380     | Turbo Amount, Change at your own risk.
#Define SNEAKHIDE       1       | Sneak Hide between kills; 1 = Yes, 0 = No
#Define ENGAGEDISTANCE  150     | How close mob must be to engage    

| ----- Varabales -----
#Define evadeTimer 	t1
#Define checkTimer 	t2
#Define targetName 	v0
#Define targetID   	v1
#Define tankName 	v2
#Define AttackTarget	v3
#Define tempVar		v4      | Simple tempvar
#Define behindTarget	v5      | 1 = True, 0 = False
#Define targetEnrage	v6      | 1 = True, 0 = False

#include routines.mac 
#turbo TRUBOAMOUNT

| ----- Main ---------------------------------
| -- Entry point for script
| -------------------------------------------- 
Sub main
   /echo "Auto Rogue Version 1.03 Starting"
   /varset tankName $p0
   /echo "$tankName is assist tank."
   /varset tempVar 0 	
   /if n SNEAKHIDE==1 {
      /doability "Sneak"
      /doability "Hide"
   }
   /goto :Wait
   /goto :Attack
/return

:Wait
   /assist $tankName
   /delay 5
   /if "$target()"=="FALSE" {
      /target $tankName
      /face nopredict
      /goto :Wait
   }
   /if "$target(type)"!="NPC" {
      /face nopredict
      /goto :Wait
   }
   /if n $tempVar!="$target(hp,pct)" /echo $target(name) targeted at $target(hp,pct)% at distance $target(distance).
   /varset tempVar "$target(hp,pct)"
   /face nopredict

   /if n "$target(hp,pct)"<=ASSISTHEALTH /if n "$target(distance)<ENGAGEDISTANCE" /if n "$target(pet)==0" /goto :DoubleCheck
   /Attack off
   /DoEvents
/goto :Wait

:DoubleCheck
   /delay 10
   /if n "$target(hp,pct)"<=ASSISTHEALTH /if n "$target(distance)<ENGAGEDISTANCE" /if n "$target(pet)==0" /goto :Attack
/goto :Wait

:Attack
   /doability "Sneak"
   /echo Fighting $target(name). It is level $target(level). 
   /varset targetName $target(name) 
   /varset targetID $target(id) 
   /varset evadeTimer EVADEREFRESH
   /varset AttackTarget 1
   /varset behindTarget 0
   /varset targetEnrage 0
   /face nopredict
   /sendkey down up 
   /if n $AttackTarget==1 /attack on 
:AttackLoop 
   /assist $tankName

   /if "$target()"=="FALSE" /goto :AttackEnd
   /if "$target(id)"!="$targetID" /goto :AttackEnd

   /if n $targetEnrage==1 /if n $behindTarget==0 /varset AttackTarget 0
   /if n $targetEnrage==1 /if n $behindTarget==1 /varset AttackTarget 1
   /if n $AttackTarget==1 /doability Backstab
   /if n $AttackTarget==1 /Attack on
   /if n $AttackTarget==0 /Attack off

   /face fast nopredict
   /if n $target(distance)>15 /sendkey down up      |If target is farther then 13 move foward
   /if n $target(distance)<6 /sendkey down down     |If target is closer then 6 move back
   /if n $target(distance)<10 /sendkey up up        |If target is closer then 10 stop moving foward
   /if n $target(distance)>9 /sendkey up down       |If target is farther then 9 stop moving back

   /face fast nopredict
   /doevents
   /if n $target(distance)<14 /if n $target(distance)>5  /goto :rotate 
/goto :AttackLoop 

:rotate
  | ----- Clockwise Rotate Check -----
   /if n $target(heading)>=180 /if n $calc($target(heading)-180)<=$char(heading) /if n $char(heading)<$calc($target(heading)-22.5) /goto :bsclock 
   /if n $target(heading)>=180 /if n $char(heading)<=180 /if n $calc($char(heading)-22.5)>$calc($target(heading)-360) /goto :bscounter 
   /if n $target(heading)<=180 /if n $char(heading)<$calc($target(heading)-22.5) /goto :bsclock 
  | ----- Counter Clockwise Rotate Check -----
   /if n $char(heading)>=180 /if n $calc($char(heading)-180)<=$target(heading) /if $char(heading)>$calc($target(heading)+22.5) /goto :bscounter 
   /if n $char(heading)>=180 /if n $target(heading)<=180 /if n $calc($char(heading)-157.5)<$calc($target(heading)+180) /goto :bsclock 
   /if n $char(heading)<=180 /if n $target(heading)<=180 /if n $char(heading)>$calc($target(heading)+25) /goto :bscounter 
   /varset behindTarget 1
/goto :AttackLoop

:AttackEnd 
   /echo "$targetName has died"
   /sendkey up up 
   /sendkey up down 
   /sendkey up ctrl
   /varset AttackTarget 0
   /varset tempVar 0
   /varset evadeTimer 0
   /attack off 
   /echo "Wating for $tankName to select new target..."
   /delay 10
   /if n SNEAKHIDE==1 {
      /doability "Sneak"
      /doability "Hide"
   }
/goto :Wait

:bsclock 
   /sendkey down ctrl 
   /sendkey down right 
   /sendkey down up 
   /sendkey up up 
   /sendkey down down 
   /sendkey up down 
   /sendkey up right 
   /sendkey up ctrl 
   /press down 
   /press ctrl 
   /face
   /varset behindTarget 0
/goto :AttackLoop  

:bscounter 
   /sendkey down ctrl 
   /sendkey down left 
   /sendkey down up 
   /sendkey up up 
   /sendkey down down 
   /sendkey up down 
   /sendkey up left 
   /sendkey up ctrl 
   /press down 
   /press ctrl 
   /face
   /varset behindTarget 0
/goto :AttackLoop 

| ----- Events called by /DoEvents -----

Sub Event_Enraged
   /if n $behindTarget==0 /varset AttackTarget 0
   /varset targetEnrage 1
   /attack off
/return 

Sub Event_Offrage 
   /varset targetEnrage 0
   /varset AttackTarget 1
   
   /attack on
/return 

Sub Event_Slainby
   /endmacro
/return

Sub Event_Timer
   /if n $p0==1 /goto :timerEvade
/return

| *** Event Subs ***

:timerEvade
   /if n "$target(hp,pct)">=30 {
      /sendkey up up
      /sendkey up down
      /attack off
      /delay 3
      /doability Hide
      /if n AttackTarget==1 /attack on
   }
   /varset evadeTimer EVADEREFRESH
/return

Vaft
a lesser mummy
a lesser mummy
Posts: 69
Joined: Fri Mar 07, 2003 6:39 am

Post by Vaft » Mon May 19, 2003 9:20 pm

Thanks for posting, it looks very well written. I like all the defines you added at the top, looks production quality. I will give it a try.

Spanky_Monkey
a ghoul
a ghoul
Posts: 103
Joined: Wed Feb 19, 2003 3:10 pm

Neat Script

Post by Spanky_Monkey » Tue May 20, 2003 10:40 am

That is a pretty neat looking script... almost makes me wanna start up a rogue :lol:

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

Nice looking script.

Post by grimjack » Tue May 20, 2003 12:24 pm

Very nice. I see some ideas I may need to incorperate into mine. Thanks for posting it.

Shocks
a ghoul
a ghoul
Posts: 101
Joined: Tue Feb 18, 2003 3:26 pm
Contact:

Grim

Post by Shocks » Tue May 20, 2003 2:28 pm

Grimjack,

Hey if you edit this at all could you post your changes pls :). I love to look over other ppls macros to learn how it works. I’m not the kind of person who can read a doc and know how it works until I see it in action.


Thanks,
Shocks

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

Re: Grim

Post by grimjack » Tue May 20, 2003 4:06 pm

Shocks wrote:Grimjack,

Hey if you edit this at all could you post your changes pls :). I love to look over other ppls macros to learn how it works. I’m not the kind of person who can read a doc and know how it works until I see it in action.


Thanks,
Shocks
Sure but most likely I would be editing my script and posting the changes under it's thread.

Jay
a lesser mummy
a lesser mummy
Posts: 59
Joined: Tue Jan 28, 2003 11:37 am

Post by Jay » Tue May 20, 2003 6:16 pm

Any major changes would be posted in a new thread, but minor changes will be posted here.

Vaft
a lesser mummy
a lesser mummy
Posts: 69
Joined: Fri Mar 07, 2003 6:39 am

Post by Vaft » Sat May 24, 2003 5:09 am

I noticed a small typo:

Code: Select all

#turbo TRUBOAMOUNT
That should be TURBOAMOUNT, Of course :lol:

Rahn
orc pawn
orc pawn
Posts: 12
Joined: Tue Mar 18, 2003 7:22 pm

how about a return =)

Post by Rahn » Sun Jun 15, 2003 4:33 pm

anyone have any code to add a autoreturn for the rogue. so it always returns to same spot after fight.

Rahn
orc pawn
orc pawn
Posts: 12
Joined: Tue Mar 18, 2003 7:22 pm

of course

Post by Rahn » Sun Jun 15, 2003 4:36 pm

of course soon as i post this i see this http://macroquest2.com/phpBB2/viewtopic.php?t=2504

=)

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Mon Jun 23, 2003 9:51 pm

I tried this macro, and it seems to work great IF the rqclient is in the foreground.

When I play with 2 EQ clients running on one machine, I was using this script to run an autorogue. But after some time I noticed that the rogue wasnt doing anything, not positioning etc., si I tabbed to the rogue and it started to do everything exactly as one would expect.

I thought the only problem MQ would have in running with multiple clients on the same machine would be mouse clicks.

Anyone know why? And perhaps how it can be solved? :)

theafkxper
a hill giant
a hill giant
Posts: 207
Joined: Sun Sep 08, 2002 6:41 pm

Post by theafkxper » Tue Jun 24, 2003 12:07 am

mine jsut crashes eqgame whenver i try to ru nit in the background =\
same with all jay's other scripts
/afk

roguish
orc pawn
orc pawn
Posts: 29
Joined: Sun Jul 21, 2002 1:11 am

Post by roguish » Wed Jun 25, 2003 12:52 am

Well, nice script but how about saying where you got the scripting (ie math) for the autopositioning...?

http://macroquest2.com/phpBB2/viewtopic ... highlight=

The auto-positioning was from a script I wrote and posted MONTHS ago. While I don't mind people using the script (reason it was posted) at least, Jay, have the decency to thank the person who did all the math to figure it out. I sat for hours on a beach in Australia with a piece of paper and pencil working that all out and then hours in Chardok perfecting that script and the sideways movement trick!!

I always did my best to say where I got major script elements from! A pet peeve of mine when people forget to reference...

;)

Roguish

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

Post by Mckorr » Wed Jun 25, 2003 9:03 am

Then I want you to put my name in any script that uses the mouse...oh, and the names of the 8 or so people that helped write the mouse code... don't forget Plazmic for MQ period...

Guys, it gets old. So many people have contributed so much code and script over the years that none of us can be expected to remember where we got it all. Yeah, it's nice to get credit for your work, but there's no point in getting snippy if someone forgets where they got it from.

Oh, and if you were on a beach in Australia working on MQ you got a lot more problems than just someone forgetting to give you credit for your snippets of code :)
MQ2: Think of it as Evolution in action.

User avatar
BlueSkies
a ghoul
a ghoul
Posts: 132
Joined: Tue Oct 01, 2002 6:22 pm

Post by BlueSkies » Wed Jun 25, 2003 11:15 am

sat for hours on a beach in Australia with a piece of paper and pencil
Yikes.

Didn't take me and my girlfriend and my good friend Jala hours to figure it out. Took a little bit of highschool trig, and a glance in a reference book. And our GoBehind code is 6 lines long.

If it would have taken hours, I wouldn't have bothered. I would have rather positioned the rogue x number of units away, then strafed around it until my heading matched within 5 units of the mobs. [EDIT] I may do this anyway -- it'd look a hell of a lot more realistic...

As for quoting references... If you posted your get behind routine, you damn well better have known that people were gonna use it without crediting you. One my my pet peeves is that whole false pride thing, that 'It's mine and you can't have it without my say-so' -- and honestly, can anyone nowadays say they've ever had a truly original idea?

I tell you what. I'm going to make it a rule (for my own scripts that I'll be posting here soon) that when people use a subroutine from one of my scripts, I NOT be given "credit" for it. The only acknowledgement I want to see in derivative works is that 'Yes, I used sections of other people's code to build my own script" -- and that's it. Open Source (of which these scripts fall under by default, since they're interpreted code and not compiled) isn't about "credit" -- it's about making something better through the efforts of multiple independant partners. And that's what we all are -- partners helping to make the MacroQuest community that much better.
Live your dreams! Blue Skies everyone