Moderator: MacroQuest Developers
Code: Select all
/if (!${bAttackTarget}) /Attack off
/if (!${bAttackTarget}) /Attack on
Code: Select all
/if (!${bAttackTarget}) /Attack off
/if (${bAttackTarget}) /Attack on
Code: Select all
#Event Enraged "#*#has become ENRAGED#*#"
#Event Offrage "#*#is no longer enraged#*#"
#Event Slainby "#*#You have been slain by#*#"
#Event Zonechange "#*#You have entered#*#"
Code: Select all
|AutoRogue 2.0m 5-22-2004
|----------------------------------------------------------------------
| By Cunning.
| 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.0m - Fixed enrage bug and new event handling.
| 2.0l - Changed Target.MaxRange to Target.MaxRangeTo.
| Removed some unnecessary delay instances from combat loop.
| Upped turbo to 40 for shits/giggles.
| Added a new boolean in custom.inc, bUseStrike.
| Fixed a logic bug in CheckDefSpecial (was causing a pause in macro if you got hit).
| 2.0k - MQ2DataVars conversion.
| 2.0j - Getbehind working...again...
| 2.0i - Fixed the weird running in circles on anchor.
| Fixed the crazy wobble that getbehind would do in certain instances.
| Changed all /face nolook fast calls back to /face fast. Wasn't a good idea.
| Tweaked melee distance on chase.
| 2.0h - Bugfixes in GetBehind and the zonechange event.
| 2.0g - MQ2Data phase 2 conversion.
| 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 sStrikeDisc to 0 also available as option.
| 2.0c - Added delays to address crashing issue.
| 2.0b - Bugfixes (hopefully). The iSetAnchor 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)
#turbo 40
#Event Enraged "#*#has become ENRAGED#*#"
#Event Offrage "#*#is no longer enraged#*#"
#Event Slainby "#*#You have been slain by#*#"
#Event Zonechange "#*#You have entered#*#"
Sub Main
/declare bAttackTarget bool outer
/declare bStrikeFlag bool outer
/declare AnchorX float outer
/declare AnchorY float outer
/declare fXLoc float outer
/declare fYLoc float outer
/declare iSetAnchor int outer
/declare sFollowTarget string outer
/declare iAssistHealthPct int local
/declare iTargetId int local
/declare iTargetIdTmp int local
/declare sAssistName string local
/declare sTargetName string local
/varset iTargetIdTmp 0
/varset bStrikeFlag 0
/echo AutoRogue v. 2.0m Started.
/if (${Defined[Param0]}) {
/varset sAssistName ${Param0}
} else {
/echo Error: The name of your assist is not optional.
/echo Usage: /macro rogue.mac AssistName <AssistHpPct> <AnchorFlag> <sFollowTarget>
}
/if (${Defined[Param1]}) {
/varset iAssistHealthPct ${Param1}
} else /varset iAssistHealthPct 90
/if (${Defined[Param2]}) {
/varset iSetAnchor ${Param2}
/if (${iSetAnchor}==2) {
/if (${Defined[Param3]}) {
/varset sFollowTarget ${Param3}
} else /varset sFollowTarget ${sAssistName}
}
} else /varset iSetAnchor 0
#include custom.inc
/echo ${sAssistName} is main assist.
/echo Will start combat when MA target is at ${iAssistHealthPct}%.
/assist off
/attack off
/if (${iSetAnchor}==1) {
/varset AnchorX ${Me.X}
/varset AnchorY ${Me.Y}
/echo Created anchor at Loc: ${AnchorY}, ${AnchorX}.
}
/if (${iSetAnchor}==2) {
/target ${sFollowTarget}
/delay 5
/if (!${Target.ID}) /varset sFollowTarget ${sAssistName}
/echo Created MoveToTarget: ${sFollowTarget}.
}
/if (${bSneakHide}) /echo SneakHide Enabled.
/if (${bUseSpecial}) {
/call CheckRegenEnd
/echo Discipline/Escape Usage Enabled.
/echo Your current endurance is ${Me.Endurance}/${Me.MaxEndurance}.
/echo Regen endurance percent: ${iRegenEndPct}.
}
/echo Waiting for ${sAssistName} to select a new target...
:Wait
/delay 1
/doevents
/call SneakHide
/call CheckRegenEnd
/call CheckAnchor
/assist ${sAssistName}
/delay 4
/if (!${Target.ID}) /goto :Wait
/if (!${Target.Type.Equal["NPC"]}) /goto :Wait
/if (${Target.CleanName.Equal[${Me.Name}]}) /goto :Wait
/if (${iTargetIdTmp}!=${Target.PctHPs}) /echo ${Target.CleanName} targeted at ${Target.PctHPs} %hp, distance ${Target.Distance}.
/varset iTargetIdTmp ${Target.PctHPs}
/if (${Target.PctHPs}<=${iAssistHealthPct} && ${Target.Distance}<${iEngageDistance}) /goto :Attack
/goto :Wait
:Attack
/echo Fighting ${Target.CleanName} | ${Target.Level} ${Target.Class.Name}.
/varset sTargetName ${Target.CleanName}
/varset iTargetId ${Target.ID}
/varset bAttackTarget 1
/varset bStrikeFlag 0
/call CheckGM
/call MoveTo
/call GetBehind
/face fast
:AttackLoop
/assist ${sAssistName}
/doevents
/if (!${Target.ID}) /goto :AttackEnd
/if (${Target.ID}!=${iTargetId}) /goto :AttackEnd
/call GetBehind
/call CheckMeleeRange
/if (${bAttackTarget}) {
/if (!${bStrikeFlag}) /call CheckStrikeSpecial
/if (${Target.Distance}<${Target.MaxRangeTo} && ${Me.AbilityReady["Backstab"]}) /doability "Backstab"
/attack on
/if (${Me.Sneaking}) /doability "Sneak"
/if (${bStrikeFlag}) /call CheckAtkSpecial
/if (${Me.AbilityReady["Hide"]}) {
/attack off
/delay 2
/doability "Hide"
}
}
/doevents
/if (!${bAttackTarget}) /Attack off
/if (${bAttackTarget}) /Attack on
/call CheckDefSpecial
/goto :AttackLoop
:AttackEnd
/echo Combat with ${sTargetName} has ended.
/keypress forward
/keypress back
/varset iTargetIdTmp 0
/varset bDiscActive 0
/varset bStrikeFlag 0
/varset bAttackTarget 0
/attack off
/echo Waiting for ${sAssistName} to select a new target.
/call SneakHide
/call CheckRegenEnd
/call CheckGM
/goto :Wait
/endmacro
Sub CheckMeleeRange
/if (!${Target.ID}) /return
/face fast
/if (${Target.Distance}>${Target.MaxRangeTo}*2) /call MoveTo
/if (${Target.Distance}>${Target.MaxRangeTo}) /keypress forward hold |If target is farther then MaxRange move forward
/if (${Target.Distance}<8) /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
/return
Sub SneakHide
/delay 4
/if (${bSneakHide}) {
: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
/declare iCount int local
/varset iCount 0
/varset fXLoc ${Me.X}
/varset fYLoc ${Me.Y}
/if (!${Target.ID}) /goto :noneed
/if (${Math.Distance[${Math.Calc[${Target.Y}-${Math.Cos[${Target.Heading.DegreesCCW}]}*10]},${Math.Calc[${Target.X}-${Math.Sin[${Target.Heading.DegreesCCW}]}*10]}]}<5) /goto :noneed
/if (${Target.Distance}>${Target.MaxRangeTo}*2) /call MoveTo
/keypress forward hold
:gobehindloop
/delay 1
/call CheckGM
/if (!${Target.ID}) {
/keypress forward
/goto :noneed
}
/if (${iCount}>1) {
/if (${fXLoc}==${Me.X} && ${fYLoc}==${Me.Y}) {
/keypress forward
/goto :noneed
}
/varset fXLoc ${Me.X}
/varset fYLoc ${Me.Y}
/varset iCount 0
}
/varcalc iCount ${iCount}+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 (${Math.Distance[${Math.Calc[${Target.Y}-${Math.Cos[${Target.Heading.DegreesCCW}]}*10]},${Math.Calc[${Target.X}-${Math.Sin[${Target.Heading.DegreesCCW}]}*10]}]}>3) /goto :gobehindloop
/keypress forward
/face fast
:noneed
/return
Sub CheckDefSpecial
/if (${bUseSpecial}) {
/if (${Me.PctHPs}<${iNimblePct}) {
/if (${Me.PctHPs}<${iEscapePct}) {
/echo Escaping.
/attack off
/varset bAttackTarget 0
/delay 2
/alt activate 102 | escape aa
/call SneakHide
/goto :EscapedWaitHeal
} else {
/echo Nimble.
/delay 2
/disc nimble
/attack off
/varset bAttackTarget 0
/delay 5
/doability "Hide"
/goto :NimbleWaitHeal
}
}
}
/goto :HpOk
:EscapedWaitHeal
/if (${Me.PctHPs}>${iHealPausePct}) {
/varset bAttackTarget 1
/return
}
/delay 10
/goto :EscapedWaitHeal
:NimbleWaitHeal
/if (${Me.PctHPs}>${iHealPausePct}) {
/varset bAttackTarget 1
/return
}
/delay hiderefresh
/doability "Hide"
/goto :NimbleWaitHeal
:HpOk
/return
Sub CheckAtkSpecial
/call CheckRegenEnd
/if (${bUseSpecial} && !${bDiscActive} && !${bRegenEnd} && ${Target.PctHPs}<${iAttackDiscPct}) {
/disc duelist
/delay 4
/disc deadly
/varset bDiscActive 1
}
/return
Sub CheckStrikeSpecial
/call CheckRegenEnd
/if (${bUseStrike} && !${bRegenEnd}) {
/varset bStrikeFlag 1
/call CheckMeleeRange
/disc ${sStrikeDisc}
:WaitForBackstabRange
/if (${Target.Distance}<${Target.MaxRangeTo}) {
/doability "Backstab"
} else {
/call CheckMeleeRange
/goto :WaitForBackstabRange
}
}
/return
Sub CheckRegenEnd
/if (!${bRegenEnd} && ${Me.PctEndurance}<${iRegenEndPct}) {
/varset bRegenEnd 1
/echo Regen endurance to full.
}
/if (${bRegenEnd}) {
/if (${Me.Endurance}==${Me.MaxEndurance}) {
/varset bRegenEnd 0
/echo Endurance regenerated.
}
}
/return
Sub CheckAnchor
/call CheckGM
/if (${iSetAnchor}==1) /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) /call MoveToAnchor
/if (${iSetAnchor}==2) {
/target ${sFollowTarget}
/delay 4
/if (${Target.Distance}>${Target.MaxRangeTo} && ${Target.ID} && ${Target.CleanName.NotEqual[${Me.CleanName}]}) /call MoveTo
}
/return
Sub CheckGM
/if (${Spawn[gm].ID}) {
/echo Waiting on GM to leave zone.
/keypress forward
/keypress esc
/attack off
/delay 4
/call SneakHide
:gmcheck
/if (${Spawn[gm].ID}) {
/delay 10
/goto :gmcheck
} else /return
}
/return
Sub MoveTo
/declare iCount int local
/varset iCount 0
/varset fXLoc ${Me.X}
/varset fYLoc ${Me.Y}
/if (!${Target.ID}) {
/keypress forward
/return
}
/if (${Target.Distance}<${Target.MaxRangeTo}) {
/keypress forward
/return
}
/echo Moving to Target: ${Target.CleanName}.
:fastmoveloop
/delay 1
/doevents
/if (!${Target.ID}) {
/keypress forward
/return
}
/face fast
/if (${Target.Distance}>${Target.MaxRangeTo}) /keypress forward hold
/if (${Target.Distance}<${Target.MaxRangeTo}) {
/keypress forward
/return
}
/if (${iCount}>2) {
/call Detectobst
/face fast
/varset iCount 0
}
/if (${Target.Distance}>${Math.Calc[${Target.MaxRangeTo}*2]}) /varcalc iCount ${iCount}+1
/goto :fastmoveloop
/return
Sub MoveToAnchor
/declare iCount int local
/varset fXLoc ${Me.X}
/varset fYLoc ${Me.Y}
/varset iCount 0
/echo Moving to Anchor at Loc: ${AnchorY}, ${AnchorX}.
:AnchorMoveLoop
/delay 1
/doevents
/face nolook loc ${AnchorY},${AnchorX}
/if (${Math.Distance[${AnchorY},${AnchorX}]}>12) {
/keypress forward hold
} else {
/keypress forward
/return
}
/if (${iCount}>2) {
/call Detectobst
/face nolook loc ${AnchorY},${AnchorX}
/varset iCount 0
}
/varcalc iCount ${iCount}+1
/goto :AnchorMoveLoop
/return
Sub Detectobst
/delay 2
/if (${fXLoc}==${Me.X}) /if (${fYLoc}==${Me.Y}) /call Hitobst
/varset fXLoc ${Me.X}
/varset fYLoc ${Me.Y}
/return
Sub Hitobst
/keypress forward
/keypress back hold
/if (${Math.Rand[2]}) {
/delay 2s
/keypress back
/keypress right hold
/delay 8
/keypress right
/if (${bUseJump}) {
/keypress forward hold
/delay 8
/keypress jump
}
} else {
/delay 2s
/keypress back
/keypress left hold
/delay 8
/keypress left
/if (${bUseJump}) {
/keypress forward hold
/delay 8
/keypress jump
}
}
/delay 10
/keypress forward hold
/return
| ----- Events called by /DoEvents -----
Sub Event_Enraged
/varset bAttackTarget 0
/attack off
/return
Sub Event_Offrage
/varset bAttackTarget 1
/attack on
/return
Sub Event_Zonechange
/keypress up
/endmacro
/return
Sub Event_Slainby
/keypress up
/endmacro
/return
Caladine wrote:A whole bunch of shit just isn't parsing right with Lax's new calculate command, most notably if statements using '=='.
Go into MQ2Utilities.c and uncomment the old calculate "ActualCalculate", and uncomment the Benchmarks line at the bottom of the file with ActualCalculate, and comment out the other.
There's two sections to the documentation (well three if you want to get technical), the introductory part of the macro, the changelog, and the in-macro supplied help (via the /rhhelp). The changelog is more or less "just for me" so that I know what I did to the macro in case some weird side-effect pops up due to a change--hasn't happened yet thankfully. The /rhhelp is just a brain tickler that provides generic syntax for the commands, and not much else. The introductory part of the macro documents all the features in detail, in the chronological order in which they were written.Rogue helper is indeed very full-featured, but that documentation is a fucking nightmare. You need to seperate the changelog from the actual docs and make it somewhat less of a labyrinth.