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.