How to optimize the speed of a script as much as possible.

Helpful script writing tricks and HowTo's
User avatar
WAZAAAAA
Posts: 89
Joined: 13 Jan 2015, 19:48

Re: How to optimize the speed of a script as much as possible.

Post by WAZAAAAA » 29 Oct 2023, 19:27

Xendrus wrote:
01 Aug 2023, 15:53
SetBatchLines, -1 Causes my games to completely freeze to 0 fps until the key is released.
as mentioned by Animan8000 and by point #5 of the thread, you're pressing buttons too fast and your game can't handle it, you need to slow down
5. The default SetBatchLines value makes your script sleep around 10-15.6 milliseconds every line. Make it -1 to not sleep (but remember to include at least one Sleep in your loops to avoid high CPU waste!).
quick solution, just add this line inside of your "freezing loop":
DllCall("Sleep","UInt",1)
Last edited by WAZAAAAA on 17 Nov 2023, 01:02, edited 1 time in total.
YOU'RE NOT ALEXANDER
LuisPro
Posts: 5
Joined: 30 Oct 2020, 16:39

Re: How to optimize the speed of a script as much as possible.

Post by LuisPro » 13 Nov 2023, 15:45

Hello, using ahk v2 changed something? something should i not use or something use in different way?

@WAZAAAAA
Can you or someone else provide this for ahk v2?

Greetings.
User avatar
WAZAAAAA
Posts: 89
Joined: 13 Jan 2015, 19:48

Re: How to optimize the speed of a script as much as possible.

Post by WAZAAAAA » 17 Nov 2023, 01:14

LuisPro wrote:
13 Nov 2023, 15:45
Hello, using ahk v2 changed something? something should i not use or something use in different way?

@WAZAAAAA
Can you or someone else provide this for ahk v2?

Greetings.
To be honest this kind of thread is less needed for AHK v2 since the 2 most important lines SetBatchLines and SendMode (among others) now use better defaults.

But still, here it is viewtopic.php?p=559263
YOU'RE NOT ALEXANDER
Post Reply

Return to “Tutorials (v1)”