r/AutoHotkey • • 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?

0 Upvotes

13 comments sorted by

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 SendEvent with a small SetKeyDelay instead of the default send mode. If neither works, the game may be ignoring simulated keypresses; Windows 11 itself might not be the whole cause

1

u/Itz_NiXiN726 5d ago

Hmm interesting, I’ll definitely give it a test. Especially the privilege level, because it does work sometimes, but not consistently at all. And the notepad test was in game, theres a chat feature and it types in the box, but doesn't consistently allow the keystrokes to control the game

2

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.

2

u/Jasmine_Levy5 5d ago

the notepad test is actually a useful clue: it shows the script runs, but not that the game accepts synthetic input. Games can handle input differently from text fields, so the Win10 vs Win11 detail is worth investigating rather than dismissing

1

u/Itz_NiXiN726 5d ago

Thank you lol their response comes off very egotistical, instead of just helping the query

0

u/UndeadPacer1987 2d ago

You don't want to learn to fish; you just want that goddamn fish. That's our problem.

And this is not a puzzle; it's just a noob 'gaming' script.

1

u/Itz_NiXiN726 1d ago

Lmao what are you on about 😂 i dont NEED the script, and the one i made works but not in every machine, so its not like it needs tweaks or something. So im confused what's gotten you so triggered. If you dont know how to remedy the issue, why comment especially with hostility. Is it a personal relationship with you and Brawlhalla? 🤔

1

u/UndeadPacer1987 1d ago

Oh, so this was your script! LMAO

1

u/Itz_NiXiN726 1d ago

Yes lmaoo

0

u/UndeadPacer1987 2d ago

Cool, if you get an erection from a puzzle like this, that's cool.

2

u/Itz_NiXiN726 7d ago

~Applauds~

2

u/Keeyra_ 7d ago

Couldn't have said better myself.