===============================================
EDIT: Completely reworked 26 Apr, working with 4/25 compile
===============================================
Requires MQ2Data and Params in compile atm.
Usage: /mac roguebot <Tankname>
additionally:
starts in a assist state, to change states:
tell the toon being controlled:
"Assist NoW" -- switches to assist mode
"Back OfF" -- switches to non-assist mode
Code: Select all
| <<RogueBot.mac>> v 1.2
| -- Tinkoman
| Rewrite of Rogue mac, using various examples form Depot.
| Thanks all that post their usable code.
|
| Basic Rogue script that will assist <Assist> declared in call.
| When started, sets an anchor at start spot, and returns there
| when not in combat, and auto hide/sneak/backstab when any of
| these options are available.
| If the bot gets stuck on initial positioning for combat, will end
| macro. This could be vastly improved, but for simplicity atm,
| prevents bot from running against an obstruction, and will just
| stand there doing nothing.
|
| ________________________________________________________________
| v1.2 added code from genbot for initial positioning for combat
|
| ________________________________________________________________
| I know there is LOTS of features that can be added, and as I add
| them, I will repost. Attempted to make as much of the code in
| the up and coming format as possible for easy transition.
|
| MQ2Data compliant
|
| Usage: /macro roguebot.mac <Assist>
#Event Enraged "has become ENRAGED"
#Event Offrage "is no longer enraged"
#Event Slainby "You have been slain by"
#Event AssistOn "Assist NoW"
#Event AssistOff "Back OfF"
#include routines.mac
#turbo 30
Sub main
/Declare AssistDo global
/Declare assisthealth global
/Declare engagedistance global
/Declare BaseXLoc global
/Declare BaseYLoc global
/Declare tankname global
/Declare targetName global
/Declare attacktarget global
/Declare behindtarget global
/Declare targetenrage global
/Declare countdown global
/Declare MyXLoc global
/Declare MyYLoc global
/varset AssistDo 1
/Varset assisthealth 100 | Change this is you want a different health to assist.
/Varset engagedistance 200 | Maximum distance from Mob to assist
/varset tankname @Param0
/varset BaseXLoc ${Me.X}
/varset BaseYLoc ${Me.Y}
/echo "RogueBot now running"
/echo "Should be assisting @tankname."
/attack off
/target @tankname
:Wait
/DoEvents
/if (!${Me.Sneaking}) /doability "Sneak"
/if (${Me.AbilityReady[Hide]}>0) /doability "Hide"
/if (@AssistDo==1) {
/assist @tankname
/delay 1s
/attack off
|===============================================
|
| Check Target Type, if is NPC,
| Continue attack routine, if IS not, wait.
|
|===============================================
/if (${String[${Target.Type}].Equal[NPC]}) {
/echo ${Target.Name} targeted at ${Target.PctHPs}% at distance ${Target.Distance}. | -Commented to remove spam
/face
/if (@assisthealth>=${Target.PctHPs}) {
/if (@engagedistance>=${Target.Distance}) {
/varset targetName ${Target.Name}
/call Do-GetBehind
/call GetBehind
/goto :Attack
}
}
}
/DoEvents
}
/goto :Wait
|===============================================
|
| Set variables for combat.
|
|===============================================
:Attack
/echo Fighting ${Target.CleanName}. It is a level ${Target.Level} ${Target.Race}.
/varset attacktarget 1
/varset behindtarget 0
/varset targetenrage 0
|===============================================
|
| Combat loop.
|
|===============================================
:AttackLoop
/if (@attacktarget==0) /Attack off
/if (${String[${Target.Type}].Equal[NPC]}) {
/call GetRightDistance
/call GetBehind
/if (@attacktarget==1) {
/if (${Target.Distance}<${Target.MaxRange}) {
/if (${Me.AbilityReady["Backstab"]}) /doability "backstab"
/attack off
/delay 1
/if (${Me.AbilityReady[Hide]}>0) /doability "Hide"
/attack on
}
}
/doevents
/goto :AttackLoop
}
|===============================================
|
| Post Combat cleanup.
|
|===============================================
:AttackEnd
/echo "@targetName" has died.
/varset attacktarget 0
/attack off
/echo "Waiting for @tankname to select a new target..."
/call GotoLoc2
/goto :Wait
/endmacro
|===============================================
|
| Subroutines.
|
|===============================================
Sub GetRightDistance
:TuneDistance
/if (${String[${Target.Type}].NotEqual[NPC]}) /return
/face nolook fast
/if (${Target.Distance}>${Target.MaxRange}) {
/keypress Forward
/keypress Forward hold |If target is farther then 16 move forward
:TuneDistanceForwardLoop
/face nolook
/if (${Target.Distance}<16) {
/keypress Forward
/return
}
/goto :TuneDistanceForwardLoop
}
/if (${Target.Distance}<${Math.Calc[${Target.MaxRange}-8]}) {
/delay 2
/keypress Back
/keypress Back hold |If target is closer then 8 move back
/timed 1 /keypress Back
}
/face nolook fast
/return
|===============================================
| GetBehind
|===============================================
Sub GetBehind
/declare relativeHeading local
:gobehindloop
/face nolook
/varset relativeHeading ${Math.Calc[${Me.Heading.DegreesCCW}-${Target.Heading.DegreesCCW}].Int}
/call GetRightDistance
/if (${String[${Target.Type}].NotEqual[NPC]}) /return
/if (${Math.Calc[${Math.Abs[@relativeHeading].Int}<=30].Int}) /goto :noneed
/if (${Math.Calc[${Math.Abs[@relativeHeading].Int}>=330].Int} && ${Math.Calc[${Math.Abs[@relativeHeading].Int}<390].Int}) /goto :noneed
|=========================
| Strafing Required
|=========================
/if (${Math.Calc[${Math.Calc[@relativeHeading].Int}<=0].Int}) {
/if (${Math.Calc[${Math.Abs[@relativeHeading].Int}<=180].Int}) /goto :StrafeRight
/goto :StrafeLeft
}
/if (${Math.Calc[${Math.Abs[@relativeHeading].Int}<=180].Int}) /goto :StrafeLeft
/goto :StrafeRight
:StrafeLeft
/keypress strafe_left Hold
/delay 3
/keypress strafe_left
/goto :gobehindloop
:StrafeRight
/keypress strafe_right Hold
/delay 3
/keypress strafe_right
/goto :gobehindloop
:noneed
/return
|===============================================
| GotoLoc2
|===============================================
Sub GotoLoc2
/keypress Forward Hold
:locloop
/face nolook fast loc @BaseYLoc,@BaseXLoc
/if (${Math.Distance[${Me.Y},${Me.X}:@BaseYLoc,@BaseXLoc]}<=10) {
/keypress Forward
/target @tankname
/face nolook
/return
}
/goto :locloop
/return
|===============================================
| Do-getbehind
|===============================================
Sub Do-getbehind
/varset countdown 0
/varset MyXLoc ${Me.Y}
/varset MyYLoc ${Me.X}
| /varset Combatstatus 1
/if (!${Target.ID}) {
/assist @MasterName
/call Delay 5
}
/if (${Math.Distance[${Math.Calc[${Target.Y}-${Math.Cos[${Target.Heading.Degrees}]}*10]},${Math.Calc[${Target.X}+${Math.Sin[${Target.Heading.Degrees}]}*10]}]}<15) /goto :noneed
/if (!${Target.ID}) /return
/keypress up hold
:gobehindloop
/if (!${Target.ID}) {
/keypress up
/return
}
/if (@countdown>=20) {
/if (@MyXLoc==${Me.Y} && @MyYLoc==${Me.X}) {
/echo Stuck ... Aborting Macro
/keypress up
/endmacro
}
/varset MyXLoc ${Me.Y}
/varset MyYLoc ${Me.X}
/varset countdown 0
}
/varadd countdown 1
/doevents
/face nolook fast loc ${Math.Calc[${Target.Y}-${Math.Cos[${Target.Heading.Degrees}]}*10]},${Math.Calc[${Target.X}+${Math.Sin[${Target.Heading.Degrees}]}*10]}
/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
/keypress up
/face nolook fast
:noneed
/keypress up
/return
|=======================================
| Events called by /DoEvents
|=======================================
Sub Event_Enraged
/varset attacktarget 0
/attack off
/return
Sub Event_Offrage
/varset attacktarget 1
/return
Sub Event_AssistOn
/varset AssistDo 1
/return
Sub Event_AssistOff
/varset AssistDo 0
/attack off
/return
Sub Event_Slainby
/endmacro
/returnI reused some old code from here, and thanks to those that originally wrote it.
I'll make an effort to keep it up to date, and add new stuff as i can.
--------------------
Working on adding in a feature that will stop combat, escape (if available, if not, evade) and hide/sneak. bot rogue getting whacked looking like a noob is one of the annoyances resulting from a dumb dps bot.
Tinkoman
