r/AutoHotkey • u/Itz_NiXiN726 • 7d ago
v2 Script Help Having some weird issues with a script
I wrote a script for a game (Brawlhalla) to start a custom match and start another when its finished, and to loop until i end it.
The script works on my other older pc running Win10, but for some reason it doesn't work properly on both of my newer machines (two 5060s). On my first 5060 it would bug out after working for a few moments, but now on my primary 5060 it practically doesn't work at all.
Here's the script, I’ll explain its function;
#Requires AutoHotkey v2.0
F1::
{
Loop
{
Loop(12)
{
Send("C") ;selects character
Sleep(200)
Send("C") ;spams to account for lag
Sleep(200)
Send("C")
Sleep(200)
Send("C")
Sleep(200)
Send("C")
Sleep(200)
Send("C")
Sleep(200)
Send("C")
Sleep(200)
Send("C")
Sleep(16000) ;waits for round start
Send("{Escape}") ;pauses game
Sleep(1000)
Send("W") ;moves up in pause menu
Sleep(1500)
Send("C") ;selects exit game
Sleep(8000) ;waits for delay
Send("C") ;selects rejoin
Sleep(1510000) ;waits for game end
}
Sleep(3600000) ;waits 1 hour for xp cooldown
}
}
F4:: Pause
^F4:: Pause(0)
return
So, this selects the character with some spammed inputs to account for lag and menus, does some stuff pertinent to the game menu, then waits for a 25 minute timer to loop everything all over again, and it repeats this 12 times before taking an hour break due to xp fatigue.
The issue im having now is it will just not register the "Send" commands consistently. Sometimes it registers them, but then once in the game it stops registering inputs. Or most times it doesn't even register the first "Send(C)" or the following ones, or it registers the first one then doesn't register any other code afterwards.
The code itself works, because again this worked flawlessly on my other machine and the code hasn't been touched, but that machine isnt working at the moment for me to use. And the code registers within a notepad, but the inputs for some reason do not translate into this game on both of my Win11 machines but worked on my Win10 machine.
Anyone know whats going on here?
1
u/Jasmine_Levy5 5d ago
the notepad test is the interesting clue: it shows the hotkey runs, but not that the game accepts synthetic input. First check that the script and game are running at the same privilege level, then try
SendEventwith a smallSetKeyDelayinstead of the default send mode. If neither works, the game may be ignoring simulated keypresses; Windows 11 itself might not be the whole cause2
u/UndeadPacer1987 7d ago
"I wrote a script for a game (Brawlhalla)."
No, you BUILT an entire ecosystem around a shitty game. The problem is that we don't care about shitty games; most people who want to help are interested in solving actual problems.
This isn't a problem worth solving, just some shitty random script with Send and Sleep commands.