Jump to content
(Open Beta) HyperSpin 2 is now available for everyone ×

Need a little help with an AHK script.


Dime333

Recommended Posts

Posted

I made this script to reset the network settings in Wacky Races (Taito Type X). I noticed that if you exit the game when the script is running, Hyperspin will start to act up since the script is sending keypresses. I have tried to make it only do the keypresses if the game is running, but once the keypresses have started, it won't stop. Will I have to use #IfWinActive before every keypress in the script?

        WinWait wrwin ahk_class wrwin
        #IfWinActive, wrwin ahk_class wrwin
        {
        Sleep, 3500
        Send, {Esc down}
        Sleep, 300
        Send {Esc up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Enter down}
        Sleep, 50
        Send {Enter up}
        Sleep, 500
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Enter down}
        Sleep, 50
        Send {Enter up}
        Sleep, 3000
        Send, {Enter down}
        Sleep, 50
        Send {Enter up}
        Sleep, 24000
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Enter down}
        Sleep, 50
        Send {Enter up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        Send, {Enter down}
        Sleep, 50
        Send {Enter up}
        return
        }
ExitScript:
	ExitApp
Posted

I solved it by making a post exit script that closes AutoHotKey.exe. Maby that won't work for everyone if you are using an AHK script while using Hyperspin. Is there a smarter way to close the script?

Posted

OK. here's the latest version that will exit the script when you exit the game. Maby not the prettiest script ever, but it works perfectly.

        WinWait wrwin ahk_class wrwin
        Sleep, 3500
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Esc down}
        Sleep, 300
        Send {Esc up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Enter down}
        Sleep, 50
        Send {Enter up}
        Sleep, 500
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Enter down}
        Sleep, 50
        Send {Enter up}
        Sleep, 3000
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Enter down}
        Sleep, 50
        Send {Enter up}
        Sleep, 24000
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Enter down}
        Sleep, 50
        Send {Enter up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Down down}
        Sleep, 50
        Send, {Down up}
        Sleep, 50
        IfWinNotActive, wrwin ahk_class wrwin
        {
        Goto, ExitScript
        return
        }
        Send, {Enter down}
        Sleep, 50
        Send {Enter up}
ExitScript:
	ExitApp
Posted

If fixes the input not responding for quite a long time when selecting vehicle and I think before or after races there are long pauses sometimes.

Posted

If fixes the input not responding for quite a long time when selecting vehicle and I think before or after races there are long pauses sometimes.

Nice!

But how exactly are you telling this script to run when you launch the game?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...