rogue.mac - AutoRogue v. 2.0j *New Parm Rdy* (4/25/2004)

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

Moderator: MacroQuest Developers

Smitty
orc pawn
orc pawn
Posts: 25
Joined: Sun Dec 21, 2003 8:56 pm

Post by Smitty » Thu Apr 22, 2004 3:34 pm

Found a couple problems .. mostly /if's that didnt have the () around them..

this seems to be working as is here.


|AutoRogue 2.0e 4-18-2004
|----------------------------------------------------------------------
| Original AutoRogue by Jay.
| Credits to GrimJack for the getbehind and moveto logic from GenBot.
|
| Usage: /macro rogue.mac Assist HpPct AnchorBit Follow
|
| Examples:
| Assist tank at 95%
| /macro rogue.mac Happytank 95 0 (or leave the zero off)
|
| Assist tank at 95%, set anchor at current loc
| /macro rogue.mac Happytank 95 1
|
| Same as above but moveto/follow a target between fights
| /macro rogue.mac Happytank 95 2 Stationarycleric
|
| DON'T FORGET TO VIEW/MODIFY YOUR CUSTOM.INC FILE!!!
|
| Version History
| 2.0f - Added GM detection (script will pause when gm in zone, resume after)
| 2.0e - Chase range improved!
| 2.0d - Fixed target moveto on engage. Set @strikedisc to 0 also available as option.
| 2.0c - Added delays to address crashing issue.
| 2.0b - Bugfixes (hopefully). The setanchor param is changed too (read above).
| 2.0a - Added follow distance and replaced depreciated /sendkey's.
| 2.0 - Added rogue offensive and defensive discipline usage option.
| Lots of code fixes/optimizations. Options in custom.inc.
| 1.9 - Added move to anchor and move to/follow target
| options between fights. Fixed sneak/hide after fight.
| Other minor code cleanup.
| 1.8 - Cleaned up some of the code, tossed the xp stuff
| and fixed events, evade and getbehind.
| 1.7 - Base code (Jay's script)

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

#turbo 250

Sub main(p0,p1,p2,p3)

/zapvars

/declare assisthealth global
/declare countdown global
/declare setanchor global
/declare AnchorX global
/declare AnchorY global
/declare MyXLoc global
/declare MyYLoc global
/declare targetname global
/declare targetid global
/declare tankname global
/declare attacktarget global
/declare tempvar global
/declare followtarget global
/declare strikeflag global

/varset tempvar 0
/varset strikeflag 0

|=======================================================
| If Assist not specified, quit
|=======================================================
/if (!${Defined[p0]}) {
/echo You need to specify a tank.. Try again.
/end
}
/varset tankname @p1 | Your assist.

|=======================================================
| If Assisthealth specified, change from default
|=======================================================
/if (${Defined[p1]}) {
/varset assisthealth @p1 | Wait until mob is below this health trigger.
} else /varset assisthealth 95
/echo Assist Health set at @assisthealth.

|=======================================================
| If setanchor specified, change from default
|=======================================================
/if (${Defined[p2]}) {
/varset setanchor @p2 | set to user defined anchor type.
} else /varset setanchor 1 | Anchor bit: 1 = stationary anchor, 2 = follow target


|=======================================================
| If follow anchor specified, change from stationary
|=======================================================
/if (${Defined[p3]}) {
/if (setanchor==1) {
/echo You set anchor to 1, must be 2 to followanchor. defaulting to stationary.
} else /varset followtarget @P3 | set to user defined anchor.
} else /echo Stationary anchor set.


#include custom.inc

/echo "AutoRogue v. 2.0f (Mod for MQ2Data)"

/assist off
/attack off

/if (@setanchor==1) {
/varset AnchorX ${Me.X}
/varset AnchorY ${Me.Y}
/echo "Created anchor at Loc: @AnchorX,@AnchorY."
}

/if (@setanchor==2) {
/target @followtarget
/if (!${Target.ID}) {
/varset followtarget @tankname
}
/echo "Created MoveToTarget: @followtarget, couldn't find @p3"
}

/if (@sneakhide==1) {
/echo "SneakHide Enabled."
/call SneakHide
}

/call CheckRegenEnd

/if (@usespecial==1) {
/echo "Discipline/Escape Usage Enabled."
/echo "Your current endurance is @maxendurance."
/echo "Regen endurance percent: @regenendpct."
}

/echo "Waiting for @tankname to select a new target..."

:Wait
/assist @tankname
/delay 1

/if (${Char.Invited}) /invite

/call SneakHide

/if (!${Target.ID} || ${String[${Target.Type}].NotEqual[NPC]}) {
/call CheckAnchor
/goto :Wait
}

/if (@tempvar!=${Target.PctHPs}) {
/echo ${Target.CleanName} targeted at ${Target.PctHPs}% at distance ${Target.Distance}.
}

/varset tempvar ${Target.PctHPs}

/if (${Target.PctHPs}<=@assisthealth) {
/if (${Target.Distance}<=@engagedistance || @engagedistance<=0) {
/if (${String[${Target.Type}].Equal[NPC]}) /goto :Attack
}
}

/call CheckRegenEnd
/call CheckAnchor

/goto :Wait

:Attack
/echo Fighting ${Target.CleanName}. It is a level ${Target.Level} ${Target.Race}.
/varset targetname ${Target.Name}
/varset targetid ${Target.ID}
/varset attacktarget 1

/face fast
/call CheckGM
/call MoveTo

:AttackLoop
/delay 1
/assist @tankname

/doevents

/if (!${Target.ID}) /goto :AttackEnd
/if (${Target.ID}!=@targetid) /goto :AttackEnd

/face fast

/if (@attacktarget==1 && ${Target.ID}==@targetid) {

/call GetBehind

/if (@strikeflag==0) {
/call CheckStrikeSpecial
/varset strikeflag 1
}

/if ([${Target.Distance}<${Target.MaxRange}] && ${Me.AbilityReady["Backstab"]}) /doability "Backstab"

/attack on
/if !${Me.Sneaking} /doability "Sneak"

/if @strikeflag==1 /call CheckDefSpecial
/if @strikeflag==1 /call CheckAtkSpecial

/if ${Me.AbilityReady[Hide]} {
/attack off
/delay 2
/doability "Hide"
}
}

/doevents

/if @attacktarget==0 /Attack off
/if @attacktarget==1 /Attack on

/face fast

/if (${Target.Distance}>=${Target.MaxRange}*3.5) /call MoveTo

/if (${Target.Distance}>${Target.MaxRange}) {
/keypress forward
/keypress forward hold |If target is farther then 18 move forward
}

/if (${Target.Distance}< {
/keypress back
/keypress back hold |If target is closer then 8 move back
}

/if (${Target.Distance}<10) /keypress forward |If target is closer then 10 stop moving forward
/if (${Target.Distance}>9) /keypress back |If target is farther then 9 stop moving back

/face fast

/goto :AttackLoop

:AttackEnd
/echo "Combat with @targetname has ended."
/keypress forward
/keypress back
/varset tempvar 0
/varset discactive 0
/varset strikeflag 0

/varset attacktarget 0
/attack off

/echo "Waiting for @tankname to select a new target..."

/call SneakHide
/call CheckRegenEnd
/call CheckGM

/goto :Wait

/return

Sub SneakHide
/delay 4
/if (@sneakhide==1) {
:WaitForSneak
/if (${Me.Sneaking}) {
/goto :WaitForHide
} else {
/doability "Sneak"
/delay 4
/goto :WaitForSneak
}

:WaitForHide
/delay 4
/if (${Me.AbilityReady["Hide"]}) /doability "Hide"
}
/return

Sub GetBehind
/varset countdown 0
/varset MyXLoc ${Char.X}
/varset MyYLoc ${Char.Y}

/if $distance($Calc[${Target.Y}-$cos(${Target.HeadingDegreesCCW}]*10,$calc(${Target.X}-$sin(${Target.HeadingDegreesCCW})*10))<3 {
/goto :noneed
}

/if !${Target.ID} /return

/keypress forward
/keypress forward hold

:gobehindloop
/delay 1

/call CheckGM

/if (!${Target.ID}) {
/keypress forward
/return
}

/if (${Target.Distance}<=${Target.MaxRange}) {
/if @countdown>=20 {
/if (@MyXLoc==${Char.X} && @MyYLoc==${Char.) /goto :noneed

/varset MyXLoc ${Char.X}
/varset MyYLoc ${Char.Y}
/varset countdown 0
}

/varadd countdown 1
/doevents

/face nolook fast loc ${Math.Calc[${Target.Y}-${Math.Cos[${Target.Heading.DegreesCCW}]}*10]},${Math.Calc[${Target.X}+${Math.Sin[${Target.Heading.DegreesCCW}]}*10]}
}

/if (${Target.Distance}>${Calc[${Target.MaxRange)*2.5]}) {
/call CheckGM
/call MoveTo
/goto :gobehindloop
}

/if (${Math.Distance[${Math.Calc[${Target.Y}-${Math.Cos[${Target.Heading.Degrees}]}*10]},${Math.Calc[${Target.X}+${Math.Sin[${Target.Heading.Degrees}]}*10]}]}>1) /goto :gobehindloop


:noneed

/keypress forward
/face fast

/return

Sub CheckDefSpecial
/if (@usespecial==1) {
/if (${Me.PctHPs}<@nimblepct) {
/echo "${Me.PctHPs} | @nimblepct"
/if (${Me.PctHPs}<@escapepct) {
/echo "Escaping."
/attack off
/varset attacktarget 0
/delay 2
/alt activate 102 | escape aa
/call SneakHide
/goto :EscapedWaitHeal
} else {
/echo "Nimble."
/delay 2
/disc nimble
/attack off
/varset attacktarget 0
/delay 5
/doability "Hide"
/goto :NimbleWaitHeal
}
}
}

:EscapedWaitHeal
/if (${Me.PctHPs}>@healpausepct) {
/varset attacktarget 1
/return
}
/delay 10
/goto :EscapedWaitHeal

:NimbleWaitHeal
/if (${Me.PctHPs}>@healpausepct) {
/varset attacktarget 1
/return
}

/delay @hiderefresh
/doability "hide"
/goto :NimbleWaitHeal
/return

Sub CheckAtkSpecial
/call CheckRegenEnd

/if (@usespecial==1) {
/if (@discactive==0) {
/if (@regenend==0) {
/if (${Target.PctHPs}<=@attackdiscpct) {
/disc duelist
/delay 4
/disc deadly
/varset discactive 1
}
}
}
}
/return

Sub CheckStrikeSpecial
/call CheckRegenEnd

/if (@regenend==0) {
/if (@strikedisc!=0) {
/delay 2
/disc @strikedisc
:WaitForBackstabRange
/delay 2
/if (${Target.Distance}<${Target.MaxRange}) {
/doability "Backstab"
} else {
/call GetBehind
/goto :WaitForBackstabRange
}
}
}
/return

Sub CheckRegenEnd
/if (@regenend==0 && ${Calc[${Me.Endurance}/@maxendurance*100]}<=@regenendpct) {
/varset regenend 1
/echo "Regen endurance to full."
}

/if (@regenend==1) {
/if (${Me.Endurance}==@maxendurance) {
/varset regenend 0
/echo "Endurance regenerated."
}
}

/if (${Me.Endurance}>@maxendurance) {
/varset maxendurance (${Me.Endurance}
}
/return

Sub CheckAnchor
/call CheckGM

/if (@setanchor==1) /if (${Math.Distance[@AnchorX,@AnchorY]>@followdistance) /call MoveToAnchor

/if (@setanchor==2) {
/target @followtarget
/delay 4
/if (${Target.Distance)>@followdistance && !${Target.ID} && ${String[${Target.CleanName}].NotEqual[${Me.Name]}) /call MoveTo
}
/return

Sub CheckGM
:gmcheck
/if (${gm==TRUE}) {
/delay 10
/goto :gmcheck
}
/return

Sub MoveTo
/varset countdown 0
/varset MyXLoc ${Char.X}
/varset MyYLoc ${Char.Y}

/if (!${Target.ID}) {
/keypress forward
/return
}

/echo "Moving to Target: ${Target.CleanName}"

:fastmoveloop
/delay 1

/if (!${Target.ID}) {
/keypress forward
/return
}

/face fast

/if (${Target.Distance}>@followdistance) {
/keypress forward
/keypress forward hold
}

/if (${Target.Distance}<=@followdistance) {
/keypress forward
/face fast
/return
}

/if (@countdown>=3) {
/call Detectobst
/face fast
/varset countdown 0
}

/if (${Target.Distance}=>${Calc[@followdistance*3]}) /varadd countdown 1
/goto :fastmoveloop
/return


Sub MoveToAnchor
/varset MyXLoc ${Char.X}
/varset MyYLoc ${Char.Y}
/varset countdown 0

/echo "Moving to Anchor at Loc: @AnchorX,@AnchorY."

:AnchorMoveLoop
/delay 1

/face nolook loc @AnchorX,@AnchorY

/if (${Math.Distance[@AnchorX,@AnchorY]}>@followdistance) {
/keypress forward
/keypress forward hold
} else {
/keypress forward
/return
}

/if (@countdown>=3) {
/call Detectobst
/face nolook loc @AnchorX,@AnchorY
/varset countdown 0
}

/varadd countdown 1
/goto :AnchorMoveLoop
/return

Sub Detectobst
/delay 2
/if (@MyXLoc==${Char.X}) /if (@MyYLoc==${Char.Y}) /call Hitobst
/varset MyXLoc ${Char.X}
/varset MyYLoc ${Char.Y}
/return

Sub Hitobst
/keypress forward
/keypress back
/keypress back hold

/if ($Rand[99]>50) {
/delay 15
/keypress back
/keypress right
/keypress right hold
/delay 5
/keypress right
/if (@usejump==1) {
/keypress forward
/keypress forward hold
/delay 5
/keypress jump
}
} else {
/delay 15
/keypress back
/keypress left
/keypress left hold
/delay 5
/keypress left

/if (@usejump==1) {
/keypress forward
/keypress forward hold
/delay 5
/keypress jump
}
}

/keypress forward
/keypress forward hold
/return

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

Sub Event_Enraged
/varset attacktarget 0
/attack off
/return

Sub Event_Offrage
/varset attacktarget 1
/attack on
/return

Sub Event_Zonechange
/keypress up
/endmacro
/return

Sub Event_Slainby
/keypress up
/endmacro
/return




Still having some problems tho..

/macro rogue.mac tankname 97 0

gives me the message waiting for 97 to choose a target.
Smitty

User avatar
SimpleMynd_01
a lesser mummy
a lesser mummy
Posts: 71
Joined: Thu May 08, 2003 3:16 pm

Post by SimpleMynd_01 » Thu Apr 22, 2004 5:02 pm

Change

Code: Select all

/varset tankname @p1 | Your assist. 
to

Code: Select all

/varset tankname @p[color=red]0[/color] | Your assist. 
-SimpleMynd

Cunning
a lesser mummy
a lesser mummy
Posts: 61
Joined: Tue Mar 23, 2004 4:42 pm

New version 2.0g *new parm ready*

Post by Cunning » Thu Apr 22, 2004 5:52 pm

Geez you guys are impatient! If you want to do your own version fine but do it in another thread, thanks. My version is posted with the new parm system and it works.

Cunning
a lesser mummy
a lesser mummy
Posts: 61
Joined: Tue Mar 23, 2004 4:42 pm

Post by Cunning » Thu Apr 22, 2004 6:06 pm

I'm starting on version 2.1 now. It will include the following + any cool ideas you guys have:

1. Working getbehind code that doesn't get you stuck on walls.
2. An item include file that will handle clicky items.
3. Smart assist changes (for when your group assist leaves).
4. A DPS calc echoed at the end of combat.

Submit your ideas so they can be in the new version!

Thanks -C-

Smitty
orc pawn
orc pawn
Posts: 25
Joined: Sun Dec 21, 2003 8:56 pm

Post by Smitty » Thu Apr 22, 2004 6:50 pm

ahh sorry about that..

Loving the script the more I use it..

seems that there is a problem with this line tho..

/if (@usespecial==1 && @discactive==0 && @regenend==0 && ${Target.PctHPs}<@attackdiscpct) {


but other than that (after I commented it out along with the discs) its working great.
Smitty

Cunning
a lesser mummy
a lesser mummy
Posts: 61
Joined: Tue Mar 23, 2004 4:42 pm

Post by Cunning » Thu Apr 22, 2004 8:31 pm

Smitty,

That function is tested and working on my end. I was executing disciplines while running the script for over three hours before I posted it, so it's something on your end.

Did you update your custom.inc? If you still have a $calc call in it, then you need to fix it. The only time I saw an error on that line was when I used an older version of custom.inc. The error msg displayed should have had lines following that /if that detailed the contents of the parse, something like:

0==0 && 1==1 && 0==1 && NULL<85

Smitty
orc pawn
orc pawn
Posts: 25
Joined: Sun Dec 21, 2003 8:56 pm

Post by Smitty » Thu Apr 22, 2004 9:01 pm

ya that was the problem.. its working great now..

question tho can you add something to keep from using offensive discs but still have defensive like nimble and escape?


thanks
Smitty

Cunning
a lesser mummy
a lesser mummy
Posts: 61
Joined: Tue Mar 23, 2004 4:42 pm

Post by Cunning » Thu Apr 22, 2004 9:37 pm

You can do that already...I just had one of the /declare calls commented incorrectly in custom.inc. It should have said this:

Code: Select all

/declare attackdiscpct global    | Use duelist or deadly disc when ${Target.PctHps} < this, 0 = off
So if you want your defensive discs to fire but not your offensive (like duelist/deadly precision), change this line in custom.inc:

Code: Select all

/varset attackdiscpct ${Math.Calc[@assisthealth-10]}
To this:

Code: Select all

/varset attackdiscpct 0
I'm correcting the comment in the custom.inc now. Thanks Smitty for pointing that out.

Smitty
orc pawn
orc pawn
Posts: 25
Joined: Sun Dec 21, 2003 8:56 pm

Post by Smitty » Thu Apr 22, 2004 9:42 pm

your are awsome!!! thanks!!!!
Smitty

Cunning
a lesser mummy
a lesser mummy
Posts: 61
Joined: Tue Mar 23, 2004 4:42 pm

Post by Cunning » Thu Apr 22, 2004 9:43 pm

Also, in custom.inc the /declare doabilityhide global variable is no longer used. You can delete that var and it's respective /varset in custom.inc, or just grab a fresh copy since I updated it.

Tinkoman
orc pawn
orc pawn
Posts: 10
Joined: Tue Apr 06, 2004 12:04 pm

Post by Tinkoman » Fri Apr 23, 2004 1:06 am

Cunning:

Didn't mean to replicate your work, but like the macro, and last compile, i didn't add in old parms.. so needed to fix it for new system, figured someone needed to. Hoped it would be helpful, nothing more.

Tinkoman

Kracken
orc pawn
orc pawn
Posts: 24
Joined: Sat Dec 20, 2003 3:01 pm

You da Man

Post by Kracken » Fri Apr 23, 2004 1:26 am

I started adding my own 'liitle' hacks to your piece, but you have taken it well beyond my feable creativity.

We're not worthy

Thanks

Cunning
a lesser mummy
a lesser mummy
Posts: 61
Joined: Tue Mar 23, 2004 4:42 pm

Post by Cunning » Fri Apr 23, 2004 4:23 am

Found a bug...In Sub Getbehind, change:

Code: Select all

/varset MyXLoc ${Me.Y} 
/varset MyYLoc ${Me.X}
to:

Code: Select all

/varset MyXLoc ${Me.X} 
/varset MyYLoc ${Me.Y} 
The code has been updated. No version change.
---

Tinkoman, it's all good. I just didn't want people posting a bunch of different versions of this code in the same thread. I don't want to confuse people. I can't stop you from posting your full versions of the code on this thread, but I can ask =) Do post snipits though...I'm all about sharing/free software/open source. You guys take what you can from my stuff...I'll sure as hell jack yours (with due credit, of course).

Kracken, thanks dude. Hopefully you'll share some of those little hacks here.

Cunning
a lesser mummy
a lesser mummy
Posts: 61
Joined: Tue Mar 23, 2004 4:42 pm

Post by Cunning » Fri Apr 23, 2004 4:30 am

BTW, this getbehind bugging up on walls is a huge bitch...if anyone has some ideas I'd love to hear them because I'm stumped. I have a version of rogue.mac that I've incorporated the Do-behind code from GenBot...it's not working well for me. The Do-behind is doing this tick-tick-tick movement (looks like a bunch of /face commands) instead of strafing. I dunno what the deal is...

MrSmallie
a hill giant
a hill giant
Posts: 167
Joined: Fri Oct 11, 2002 11:18 am

Post by MrSmallie » Fri Apr 23, 2004 2:18 pm

I haven't played with the new system much yet, but previously I had limited the use of holding down the move forward key to longer ranges only. (e.g. if target distance < 40, just do single key presses). It makes you "walk" up at the end. With strafing, you still want to hold down the left/right keys though.
Me
[img]http://home.comcast.net/~mrsmallie/ches.JPG[/img]