[Tool] AutoHotkey scripts

Important! The following program is meant to contain in the long run most if not all the scripts from this thread.

Topic for useful scripts in AHK
Automatic camera (following your character)
Autocasting for tanky Primal Strike Warder (3 skills each with different behaviour)
Better autocasting of multiple skills (frequencies, delays)
Faster camera rotation using keyboard or scroll wheel
Reversed Disengagement Movement Skill (Rune of Ishtak’s Mercy)
Hide All Items (Loot Filter) during fight
Attack/Move your character and use a skill with just Left Click (if i.e. it cannot be bound to it)
Attack/Move your character and pets with just one button + picking up all items from the ground by holding Left Click
Use Movement skill even when Right Clicking UI elements
Inquisitor Seal cast under your feet when using controller
Inquisitor Seal cast under your feet when using mouse and keyboard
Primal Strike + Savagery + movement on Left Click

Attack/Move your character and pets with just one button + picking up all items from the ground by holding Left Click

I have Primal Strike on Left Click, Pet Attack on A.
With this script I move/attack with my character holding Left Click,
Wind Devils and Briarthorn automatically follow and attack/debuff targets I’m fighting with.
You can also pick up all the items by holding the Left Click.

The following spams ‘A’ and Left Click after you hold Left Click for a while
(to retain standard Left Click action)

#If WinActive(“Grim Dawn”)

LButton::
Click

KeyWait, LButton, T0.2
if ErrorLevel
{
    while GetKeyState("LButton", "P")
    {
        Click
        Send {a}
        Sleep, 30
    }
}

Return

If you use other scripts, please share.

4 Likes

Use Movement skill even when Right Clicking UI elements

It triggered me in Diablo III that you cannot Leap/Teleport/etc. on UI with Right Click. The solution there was to hide UI for a brief moment when Right Clicking. Grim Dawn doesn’t have this option but fortunately controls are not as restrained as in D3 and you can solve the problem with a simple one-liner.

~RButton::Send {7}

[Right Click becomes Right Click + 7, set Right Click to nothing and 7 to Movement Skill]

Been using this script as a draft for my SBoE spam.
I changed the 2nd “Click” (in the while loop) to a “Click Down”.
This way there is actually a click down when you hold LMB - instead of a machine gun click (which is responsible for clunkiness when dragging the map e.g.)

1 Like

Remember you can always use something like
Tab::Suspend
if you want standard behavior outside combat

you can also make middle button do this thing, I mean
MButton::
[rest of the code the same]

I just remembered why I needed “Machine Gun Left Click” - to pick up stuff on the ground without clicking like a mad man!

Use this code, it will be better for your situation (without “Click, down” in a loop). Cleaner but without machine gun picking up items.

~LButton::
    KeyWait, LButton, T0.2
    if ErrorLevel
    {
        while GetKeyState("LButton", "P")
        {
            Send {7} ;key responsible for Storm Box
            Sleep, 25
        }
    }
Return

Also the sleep time can be longer, like 100 ms insead of 20 ms, in your case. I needed 25 ms for fluent movement in the ‘machine gun’ version but for just casting Storm Box in a loop when left click is hold normally not spammed you can easy get by with 100 - 200 ms I think. Doesn’t make a difference probably, just saying in case some performance problems.

Inquisitor Seal cast under your feet when using controller

shift := 0
1::
    WinGetActiveStats, Title, Width, Height, X, Y
    MouseMove, shift + Width/2, Height/2
    shift := shift ^ 1
    Sleep, 10
    Send {Click, right}
Return

One guy didn’t like the fact that the seal is cast in front of your character if using gamepad.
The solution is to:

  1. bind Inquisitor Seal to Right click in Mouse & Keyboard mode
  2. bind ‘1’ to some controller key using Steam Configuration (you need to access ‘Legacy Keys’ menu)
  3. run the script
  4. unfortunately you need to move analog stick a bit after every such cast to go back to controller mode from mouse mode

More info here: A self-target action for Controller

Man, I like that.
Can´t I just use this one If I ´m playing with Mouse & Keyboard as well?

On controller mode, any way to auto-move my character to perhaps nearest monster/object the character is facing whenever I use a default weapon attack skill?

Was hoping something similar to how movement skills like Blitz and SS works where they auto-target. Playing a melee char on the controller is such a subpar experience.

@Kuma Yeah this sucks man. That’s the reason why I’ve switched to M&K to play melee Primal Strike. The guy doesn’t approach enemies and sometimes swings in the air whereas with M&K he approaches automatically and you never swing in the air. Unfortunately I cannot do anything about since I don’t read the game’s memory and I cannot read the position of the monster you are targetting with a controller (the cursor is hidden and is in a completely different place then)

@klasperstanze
Inquisitor Seal cast under your feet when using mouse and keyboard

SendMode Input
;#UseHook
#NoEnv
#SingleInstance Force
#MaxHotkeysPerInterval 1000 
#MaxThreadsPerHotkey 1
#KeyHistory 50
;#InstallKeybdHook
;#InstallMouseHook
SetWorkingDir %A_ScriptDir%

s::
    WinGetActiveStats, Title, Width, Height, X, Y
    MouseGetPos, xpos, ypos
    BlockInput, MouseMove
    MouseMove, Width/2, Height/2
    Sleep 10 ;Sleep, 25 lowered it, needs testing in specific case
    Send {3}
    ;Sleep, 25 not needed in most cases, test it
    MouseMove, xpos, ypos
    BlockInput, MouseMoveOff
Return

A few remarks:

  1. I included my settings in the beginning since not all scripts work well if I mess them up
  2. s:: -> the key you’d like to cast the seal with
  3. Send {3} -> bind this key to da Seal
  4. The keys in 2) and 3) should be different. I can make it work when it’s one and the same key but it has some minor problems so I would prefer these to be different. But if you really need this to be one key, tell me
2 Likes

That´s just great! Works perfectly! Thanks again!

Nice!
But shouldn´t the 1st line of the top script do the same? Anyway, I had to delete that “if winactive…” in order to make the script work.

You can replace that entire loop with the following line:

#if WinActive("Grim Dawn")

…which is documented here: https://www.autohotkey.com/docs/commands/_If.htm

That is the general syntax for “contextual” hotkey stuff, as in, “only activate the hotkey when a specific application is active.”

It’ll respond instantly, though, instead of taking a whole second to toggle like your loop.

1 Like

Thanks. I know this of course and tested it in some previous program and it didn’t work that’s why I made up this Loop stuff glad it’s not needed. It must have not worked due to some silly mistake. I deleted the post so that it doesn’t confuse people.

[edit] No, it sometimes doesn’t work. When I configure keys to rotate, they don’t work in-game with this directive and work without it. When I configure scroll to rotate, it works (and keys work after scrolling for one time). Very weird behaviour that’s why I’m going back to Loop. I really don’t understand it. And I saw messages on some forums with people having the same problem.

Primal Strike + Savagery + movement on Left Click

~LButton::
    KeyWait, LButton, T0.2
    if ErrorLevel
    {
        while GetKeyState("LButton", "P")
        {
            Send {7} ;key Savagery is bound to
            Sleep, 1900 ;delay to Savagery so that we use it just to keep the buff up
        }
    }
Return

The number of Primal Stack attacks barely changes since the animation of Savagery after Primal Strike is very short. Especially with high attack speed.

1 Like

Niiice idea! Sort of that can also be used for warlords who chose to use cadence and rf at the same time. Its always a pita doing this manually.

1 Like

Don’t know if you’re using the seal macro at the moment but it still works for me if I remove the second sleep and lower the first sleep from 25 to 10 (less cursor flickering and more fluid).

I do. Gonna try it!

Lmao the script turns on not only when Grim Dawn is active but also when i.e. I have a tab opened in Firefox “Grim Dawn Item Databse” (Grim Tools).

Tried it. Flicker is not observable anymore. But sometimes in combat the script fails to hit the middle of the screen. Cannot really say why. Not too big of an issue though.

This happens when the sleep is too low, especially in the middle of the combat with lower fps. Just need to find the lowest value that doesn’t cause that :slight_smile:

Reversed Disengagement Movement Skill (Rune of Ishtak’s Mercy)

RButton::
    WinGetActiveStats, Title, Width, Height, X, Y
    MouseGetPos, xpos, ypos 
    MouseMove, Width-xpos, Height-ypos 
    Sleep, 30
    Send {4}
    MouseMove, xpos, ypos
Return

You move in the direction of the cursor instead of backwards as it is by default.

2 Likes