Code:
//******************************* //*****___MageAttack v2.2___***** //******************************* //For AC Tool 4.6.2 //1024x768 Screen Res //BETA VERSION - would appreciate any feedback that may improve this macro //Have not attempted to make window positions fixed yet //You may need to adjust a couple of pixel locations to get everything working SetActiveWindow EverQuest II* Delay 1000 Constants // Attack Limits MinAttackLevel = 2 MaxAttackLevel = 5 // when resting, bot will begin attacking when target is aquired AttackOnTarget = 1 GoodTarget = 0 HealthLow = 0 ManaLow = 0 //Flags NeedRest = 0 Sitting = 0 TargetAquired = 0 AttackTarget = 0 CheckForLoot = 0 LootWindowPresent = 0 TargetCount = 0 AttackScriptRunning = 0 WasTooFarAway = 0 DebugStep = 0 UnderAttack = 0 //Behavior options LootingOn = 1 // Allows mobs to die right in front of you but you take more damage while fighting PursueOn = 1 // Allows char to move forward when TooFarAway message is on screen StrafeOn = 1 // Allows char to strafe to left when CantSeeTarget message is on screen PullSpell = 6 // Configured to be a DOT spell at present PullSpellCastingDelay = 1000 PullSpellRecoveryDelay = 500 PullSpellRecastDelay = 8000 CastingDelay = 0 PaintMessageDelay = 500 End // notes // need to make the optional features work // The main loop Call Init While 1 = 1 Delay 50 Call UnderAttack Call Rest If $Sitting = 0 Call GetTarget End Call AttackTarget Call Loot Call CloseGroupInviteWindow End Procedure CloseGroupInviteWindow //Pixel Check at 600, 471 should be color 206,182,123 LoadRGB 600, 471 If {RGBRed} = 206 AND {RGBBlue} = 182 AND {RGBGreen} = 123 MousePos 610, 483 LeftClick Keys /say No thanks {return} End End Procedure Loot If $LootingOn = 1 Call CheckForLoot Call CheckForLootWindow Call GrabLoot End End Procedure CheckForLoot If $CheckForLoot = 1 MousePos 500, 600 Delay 250 DoubleClick Delay 500 Set $CheckForLoot = 0 Set $LootWindowPresent = 1 End End Procedure GrabLoot If $LootWindowPresent = 1 MousePos $LootX, $LootY Delay 250 LeftClick Set $LootWindowPresent = 0 End End //Not in use at this time. Pixel location wrong. Procedure CheckForLootWindow LoadRGB 86,142 If {RGBRed} = 66 AND {RGBGreen} = 49 AND {RGBBlue} = 60 Set $LootWindowPresent = 1 End End Procedure UnderAttack Set $UnderAttack = 0 If $AttackScriptRunning = 0 Call IsTargetAquired Call NeedToRest If $TargetAquired = 1 AND $NeedRest = 1 Set $AttackTarget = 1 Set $UnderAttack = 1 End End End Procedure AttackTarget If $AttackTarget = 1 Set $AttackScriptRunning = 1 If $LootingOn = 1 Else Keys 8 Delay 3500 End Call CastPullSpell Delay $PaintMessageDelay //Time for error message to paint on screen Compute $CastingDelay = $CastingDelay - $PaintMessageDelay If $CastingDelay > 0 Delay $CastingDelay End Keys 2 Delay 500 While $TargetAquired = 1 If $PursueOn = 1 Call IsTooFarAway End If $StrafeOn = 1 Call CantSeeTarget End Keys 5 Delay 500 Keys 5 Delay 2000 Call IsTargetAquired End Set $AttackTarget = 0 Set $CheckForLoot = 1 End Set $AttackScriptRunning = 0 Set $TargetCount = 0 Set $NeedRest = 1 End Procedure CastPullSpell Constants SuccessfullyCast = 0 End Set $CastingDelay = $PullSpellCastingDelay While $SuccessfullyCast = 0 Keys $PullSpell Call IsTooFarAway End Delay $CastingDelay End Procedure IsTooFarAway Delay 500 LoadRGB $TooFarAwayX, $TooFarAwayY Compute $TooFarAwayR = {RGBRed} Compute $TooFarAwayG = {RGBGreen} Compute $TooFarAwayB = {RGBBlue} If $TooFarAwayR = 100 AND $TooFarAwayG = 255 AND $TooFarAwayB = 255 Set $SuccessfullyCast = 0 While {RGBRed} = 100 AND {RGBGreen} = 255 AND {RGBBlue} = 255 LoadRGB $TooFarAwayX, $TooFarAwayY Keydown {up} 500 Compute $CastingDelay = $CastingDelay - 500 End Else Set $SuccessfullyCast = 1 End End Procedure CantSeeTarget LoadRGB $CantSeeTargetX, $CantSeeTargetY If {RGBRed} = 100 AND {RGBGreen} = 255 AND {RGBBlue} = 255 Keydown ~A 500 Compute $CastingDelay = $CastingDelay - 500 End End Procedure Init Call SetCoordinates Call SetColors End Procedure Rest Call IsTargetAquired Call NeedToRest Call IsSitting If $NeedRest = 1 AND $TargetAquired = 0 If $Sitting = 0 Call SitDown End Else If $Sitting = 1 Call StandUp End End End Procedure IsSitting //Check pixel on sit button to see if sitting LoadRGB $SittingX, $SittingY If {RGBRed} = 0 AND {RGBGreen} = 0 AND {RGBBlue} = 0 Set $Sitting = 1 Else Set $Sitting = 0 End End Procedure SitDown Call IsSitting If $Sitting = 0 Keys /sit {RETURN} Set $Sitting = 1 End End Procedure StandUp Call IsSitting If $Sitting = 1 Keys /stand {RETURN} Set $Sitting = 0 End End Procedure NeedToRest Call CheckHealth Call CheckMana If $HealthLow = 1 or $ManaLow = 1 Set $NeedRest = 1 Else Set $NeedRest = 0 End End Procedure CheckHealth LoadRGB $HealthX, $HealthY If {RGBRed} = $HealthR AND {RGBGreen} = $HealthG AND {RGBBlue} = $HealthB Set $HealthLow = 0 Set $NeedRest = 0 Else Set $HealthLow = 1 Set $NeedRest = 1 End End Procedure CheckMana LoadRGB $ManaX, $ManaY If {RGBRed} = $ManaR AND {RGBGreen} = $ManaG AND {RGBBlue} = $ManaB Set $ManaLow = 0 Set $NeedRest = 0 Else Set $ManaLow = 1 Set $NeedRest = 1 End End Procedure BuffChar // buff char and set timer till buff expires End Procedure IsTargetAquired LoadRGB $SoloX, $SoloY Compute $SoloR = {RGBRed} Compute $SoloG = {RGBGreen} Compute $SoloB = {RGBBlue} LoadRGB $GroupX, $GroupY Compute $GroupR = {RGBRed} Compute $GroupG = {RGBGreen} Compute $GroupB = {RGBBlue} LoadRGB $TrgtHealthX, $TrgtHealthY Compute $TrgtHealthR = {RGBRed} Compute $TrgtHealthG = {RGBGreen} Compute $TrgtHealthB = {RGBBlue} If $TrgtHealthR = 0 AND $TrgtHealthG = 0 AND $TrgtHealthB = 0 Set $TargetAquired = 0 Else Set $TargetAquired = 1 End If $TargetAquired = 1 If $SoloR = 0 AND $SoloG = 0 AND $SoloB = 0 Set $TargetType = 2 //Must be a group target Else Set $TargetType = 1 //Must be a solo target End End End Procedure GetTarget // Scan area for a mob unless you already have one on target // identify mob level // aquire next target if needed Call IsTargetAquired // Sets $TargetAquired Call IsSitting // Sets $Sitting Set $DebugStep = 1 Delay 333 // Get a target unless you are sitting or already have one. If $TargetAquired = 0 AND $Sitting = 0 Keys {tab} Compute $TargetCount = $TargetCount + 1 If $TargetCount > 7 Call NextMove Set $TargetCount = 0 End Delay 100 Call IsTargetAquired If $TargetAquired = 0 Call NextMove End // Delay for debugging purposes. Turn on if aquiring targets before ready // Delay 7777 End Set $DebugStep = 2 Delay 333 // If you have a target, and you are in attack mode, then evaluate it If $TargetAquired = 1 AND $AttackOnTarget = 1 //Counts how many times you have tried to find a target before calling for a movement Compute $TargetCount = $TargetCount + 1 Call EvaluateTarget If $AttackTarget = 0 If $TargetCount > 7 Call NextMove Set $TargetCount = 0 End Call NextTarget End End End Procedure EvaluateTarget Constants Mob = 0 End If $TargetType = 1 LoadRGB $SoloX, $SoloY End If $TargetType = 2 LoadRGB $GroupX, $GroupY End If {RGBRed} = $GreenMobR AND {RGBGreen} = $GreenMobG AND {RGBBlue} = $GreenMobB Set $Mob = 2 Else If {RGBRed} = $BlueMobR AND {RGBGreen} = $BlueMobG AND {RGBBlue} = $BlueMobB Set $Mob = 3 Else If {RGBRed} = $WhiteMobR AND {RGBGreen} = $WhiteMobG AND {RGBBlue} = $WhiteMobB Set $Mob = 4 Else If {RGBRed} = $YellowMobR AND {RGBGreen} = $YellowMobG AND {RGBBlue} = $YellowMobB Set $Mob = 5 Else If {RGBRed} = $RedMobR AND {RGBGreen} = $RedMobG AND {RGBBlue} = $RedMobB Set $Mob = 6 Else Set $Mob = 1 End End End End End //Delay 3333 If $Mob >= $MinAttackLevel AND $Mob <= $MaxAttackLevel AND $TargetType = 1 //Delay 4444 Set $AttackTarget = 1 // later, when scanning, restart movements. Set $NextMove = 0 End End Procedure NextTarget Keys {tab} End Procedure SetCoordinates // set location of pixels to check for health, // mana, solo, TooFarAway, cantseetarget Constants HealthX = 0 HealthY = 0 ManaX = 0 ManaY = 0 SoloX = 0 SoloY = 0 GroupX = 0 GroupY = 0 LootX = 0 LootY = 0 LittleArrowX = 0 LittleArrowY = 0 TooFarAwayX = 0 TooFarAwayY = 0 CantSeeTargetX = 0 CantSeeTargetY = 0 SittingX = 0 SittingY = 0 TargetType = 0 TrgtHealthX = 0 TrgtHealthY = 0 End Compute HealthX = {WindowLeft} + 124 Compute HealthY = {WindowTop} + 46 Compute ManaX = {WindowLeft} + 124 Compute ManaY = {WindowTop} + 54 Compute SoloX = {WindowLeft} + 76 Compute SoloY = {WindowTop} + 107 Compute GroupX = {WindowLeft} + 86 Compute GroupY = {WindowTop} + 115 Compute LootX = {WindowLeft} + 158 Compute LootY = {WindowTop} + 323 Compute LittleArrowX = {WindowLeft} + 0 Compute LittleArrowY = {WindowTop} + 0 Compute TooFarAwayX = {WindowLeft} + 449 Compute TooFarAwayY = {WindowTop} + 621 Compute CantSeeTargetX = {WindowLeft} + 433 Compute CantSeeTargetY = {WindowTop} + 625 Compute SittingX = {WindowLeft} + 352 Compute SittingY = {WindowTop} + 710 Compute TrgtHealthX = {WindowLeft} + 13 Compute TrgtHealthY = {WindowTop} + 101 End Procedure SetColors // set default colors for health, mana, mobs, // bad target messages Constants HealthR = 0 HealthG = 251 HealthB = 0 ManaR = 107 ManaG = 98 ManaB = 246 GrayMobR = 135 GrayMobG = 135 GrayMobB = 135 GreenMobR = 64 GreenMobG = 255 GreenMobB = 64 BlueMobR = 0 BlueMobG = 190 BlueMobB = 255 WhiteMobR = 255 WhiteMobG = 255 WhiteMobB = 255 YellowMobR = 255 YellowMobG = 255 YellowMobB = 64 RedMobR = 255 RedMobG = 48 RedMobB = 48 BadTargetR = 100 BadTargetG = 255 BadTargetB = 255 SoloR = 0 SoloG = 0 SoloB = 0 GroupR = 0 GroupG = 0 GroupB = 0 TooFarAwayR = 0 TooFarAwayG = 0 TooFarAwayB = 0 TrgtHealthR = 0 TrgtHealthG = 0 TrgtHealthB = 0 End End // Moves the bot in preparation for target scanning. Procedure NextMove Constants NextMove = 0 End Keydown {right} 400 End