Creating Image-Based AHK rotations/macros menu

User Tag List

Results 1 to 3 of 3
  1. #1
    Saigne's Avatar Private
    Reputation
    5
    Join Date
    Feb 2012
    Posts
    13
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating Image-Based AHK rotations/macros [Updated 05/03/2012]

    This will be a short, but detailed guide on how to use Autohotkey to create your own rotations/macros. Yes, I know there are already several rotations available out there, but there are a few problems with all of them. Most notably, your screen will get flooded in red text.

    Anyway, onward to creating your own. Before we begin, you will need a few programs. Grab these pieces of software and install them if you do not have them already:



    Now, to begin. First, make sure the game is fired up and minimize it to the background. Now, on your desktop, right click anywhere in the blank area and click New --> AutoHotkey Script. A notepad should open.

    This is what you should put inside:


    Code:
    #SingleInstance Force
    #NoEnv
    SetWorkingDir, C:\Rotations
    SendMode Input
    CoordMode Pixel
    
    $NumPad2::
    Loop
    {
      ImageSearch FoundX, FoundY, 2, 678, 81, 791, UnReturnableWill.bmp
      if ErrorLevel = 0
        {
        Send 0
        Sleep 50
        }
      ImageSearch FoundX, FoundY, 1215, 814, 1324, 840, Interrupt.bmp
      if ErrorLevel = 0
        {
        ImageSearch FoundX, FoundY, 23, 669, 53, 688, Electrocute.bmp
        if ErrorLevel = 0
          {
          Send 9
          Sleep 50
          }
        else
          {
          ImageSearch FoundX, FoundY, 20, 97, 52, 118, Jolt.bmp
          if errorLevel = 0
            {
            Send 2
            Sleep 50
            }
          }
        }  
      ImageSearch FoundX, FoundY, 965, 820, 1360, 893, *50 Affliction.bmp
      if ErrorLevel = 1
        {
          Send {NumPad7}
          Sleep 50
        }
      ImageSearch FoundX, FoundY, 712, 957, 737, 980, Shock.bmp
      if ErrorLevel = 0
        {
        Send {NumPad2}
        Sleep 50
        }
      ImageSearch FoundX, FoundY, 764, 957, 789, 979, Thrash.bmp
      if ErrorLevel = 0
        {
        Send {NumPad3}
        Sleep 50
        }
      ImageSearch FoundX, FoundY, 659, 963, 687, 981, SaberStrike.bmp
      if ErrorLevel = 0
        {
        Send {NumPad1}
        Sleep 50
        }
      return
    }
    
    $NumPad3::
    Loop
    {
      ImageSearch FoundX, FoundY, 1215, 814, 1324, 840, Interrupt.bmp
      if ErrorLevel = 0
        {
        ImageSearch FoundX, FoundY, 23, 669, 53, 688, Electrocute.bmp
        if ErrorLevel = 0
          {
          Send 9
          Return
          }
        else
          {
          ImageSearch FoundX, FoundY, 20, 97, 52, 118, Jolt.bmp
          if errorLevel = 0
            {
            Send 2
            Return
            }
          }
        }
      ImageSearch FoundX, FoundY, 2, 678, 81, 791, UnReturnableWill.bmp
      if ErrorLevel = 0
        {
        Send 0
        Return
        }
      else
      Imagesearch FoundX, FoundY, 797, 755, 1124, 794, Castbar.bmp
      if ErrorLevel = 0
        {
          return
        }
      else if ErrorLevel = 1
        {
        ImageSearch FoundX, FoundY, 965, 820, 1360, 893, *50 Affliction.bmp
        if ErrorLevel = 1
          {
            Send {NumPad7}
            Return
          }
        else
        ImageSearch FoundX, FoundY, 712, 957, 737, 980, Shock.bmp
        if ErrorLevel = 0
          {
          Send {NumPad2}
          Return
          }
        else
        ImageSearch FoundX, FoundY, 599, 778, 953, 892, Wrath.bmp
        if ErrorLevel = 0
          {
          ImageSearch FoundX, FoundY, 918, 957, 950, 983, CrushingDarkness.bmp
          if ErrorLevel = 0
            {
            Send {NumPad6}
            Return
            }
          else ImageSearch FoundX, FoundY, 817, 957, 845, 978, LightningStrike.bmp
          if ErrorLevel = 0
            {
            Send {NumPad4}
            Return
            }
          }
        else
        ImageSearch FoundX, FoundY, 868, 963, 896, 982, ForceLightning.bmp
        if ErrorLevel = 0
          {
          Send {NumPad5}
          Return
          }
        }
      Sleep 100
      return
    }
    Now, this is just a guide to go by. This rotation is for my level 25 Sorcerer. Now, go back into the game. Remember that a lot of skills for the juggernaut are reactive based, so you'll have to fight a monster for the key you want to hit to become active, such as the Retaliation ability. Anyway, once you have a monster targeted and the abilities showing as able to be used, hit Alt+PrintScreen. This will print a copy of what you see to your clipboard.

    Now, fire up MSPAINT (or other editing software). Press Ctrl+V to paste in the image that you just copied. Near the bottom of the screen, or wherever you keep your abilities, you will want to use the selection tool to "Cut Out" the image, but make sure you do not grab the numbers in the ability. For instance, the first skill will usually have 1 in the top left corner, then proceeding to the right, 2, 3, 4, etc. Make sure you do not have this number in the ability. It'll just make things simpler. Also, leave a small bit of room around the edges of the ability icon, just a few pixels. Now, once you have the ability you want selected, copy it. Now, create a new image and paste in the ability. Crop the image to it's new size, and you're done. It should just be a small icon.

    Now, we'll first want to make sure we have a C:\Rotations folder. Create that. Now save the ability icon that you just saved as <ABILITYNAME>.BMP. Make sure to save as 24-bit bitmap, because this is one of the lossless formats that AHK can handle.

    Now, fire up PointPosition. You will want to get the position of the upper-left pixel and the lower-right pixel of where your abilities are located. Put these pixel locations into the code that I pasted above in X, Y, X, Y format on the ImageSearch lines. Also, put in the ability name.bmp, as you see I have done. Just below the ability name, where you see Send {NumPad1}, replace that with the number of the ability. I use a Razer Naga for my keys, and they're sent as NumPad keys. You'll probably replace this with 1, 2, 3, etc, without the brackets. You can check AutoHotkey's website for more documentation on what the keys are. Note: You will generally want to avoid using large areas of the screen, such as 0, 0, 1920, 1080, because this will use a lot of processing power to do. For each ImageSearch, you'll want to limit it to a fairly small area of the screen.

    Repeat these steps for as many abilities as you want. You'll generally start with the highest-cooldown skill and work your way down to abilities that have no cooldowns. Anyway, in my example, when I hold down NumPad2, it will fire Force Scream, then Retaliation, then Sundering Assault, and so on, as soon as they are available to be used. You'll now want to save the script you've just created as something like CharacterName.AHK, since each character will want a different set of keys and whatnot. Now, you can simply double-click the .AHK to run it.

    Edit: If you want, you can put a MsgBox Found abilityname at %FoundX%, %FoundY% to narrow your searches to the exact pixel to scan at to save some CPU steps. Also, setting preferences --> User Interface --> Cooldown Settings --> Show Ready Flash and Show Global Cooldown Ready Flash can be disabled to keep your keys firing faster.

    5/3/2012 Edit:
    I've changed up the script for my sorcerer and cleaned my code a bit. The ImageSearch now only scans exactly where the icons are. To do this, I added the width and height of the bitmap to the found location of the image. I also used else statements so that only one key is fired per rotation. I will also attach my images, but there is a good chance they will not work for you, due to differing resolutions and video settings, but you can examine them at the least.

    This script can obviously use some fine tuning, but this should get you going far enough to at least have something usable. Enjoy!
    Attached Files Attached Files
    Last edited by Saigne; 05-03-2012 at 08:29 AM. Reason: Updated Steps

    Creating Image-Based AHK rotations/macros
  2. #2
    Vinshom's Avatar Contributor
    Reputation
    86
    Join Date
    Apr 2012
    Posts
    426
    Thanks G/R
    11/21
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good, I dont know why not one commented in this great job.

  3. #3
    twinbladz3's Avatar Member
    Reputation
    1
    Join Date
    Sep 2018
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i cant seem to make it work ,ive tried it several times following exact steps.

Similar Threads

  1. Frost Spec DK DPS Rotation Macro
    By HonorEtVeritas in forum WoW UI, Macros and Talent Specs
    Replies: 7
    Last Post: 07-30-2011, 12:35 AM
  2. Rotation Macro's ?
    By Cookie799 in forum WoW UI, Macros and Talent Specs
    Replies: 3
    Last Post: 03-02-2011, 11:26 AM
  3. Ret Pally Rotation Macro
    By Sikas in forum WoW UI, Macros and Talent Specs
    Replies: 32
    Last Post: 02-12-2010, 07:25 PM
  4. DK dps rotation macro(blood/unholy)
    By Shakenbaken2 in forum WoW UI, Macros and Talent Specs
    Replies: 7
    Last Post: 08-05-2009, 11:10 AM
  5. [REQUEST] MM Shot Rotation macro.
    By Performer in forum World of Warcraft General
    Replies: 2
    Last Post: 01-19-2008, 03:55 AM
All times are GMT -5. The time now is 05:10 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search