0

At the very beginning of Chrono Trigger at the Millennial Fair there is a (soda pop) drinking game where you need to tap A repeatedly. It is ridiculously hard, so I wrote a script that can tap A much faster than I can. I chose to use AutoIt, and it worked perfectly the very first time I tried it.

Now trying to do this with AutoHotkey, and it has no effect, in either ZSNES v1.51 or bsnes v115.

There is even an AutoHotkey forum post where someone is trying this same thing: sending keystrokes to ZSNES. A test suite is provided to check the various input methods that are configurable in AutoHotkey. Now, I ran this test suite, with ZSNES running, and nothing had any effect whatsoever. In contrast, the person in the forum seems to have discovered something that worked, and was able to accomplish several hours of grinding. https://www.autohotkey.com/boards/viewtopic.php?t=65655

Is there some input configuration option in AHK that I should be using?
How does AutoIt just work correctly by default?


Sorry if this is too technical. This script is simple (it taps A and you can pause it) and I know there are technical and semi-technical people here who play games and no doubt write scripts that would put this to shame. You know more than me, and might have so idea of what is wrong here.

Using AutoIt v3.3.10.2 / AutoHotkey v1.1.30.00 / scripts below for reference


AutoIt 3 script (working everywhere!):

; Press the Left Alt key repeatedly while script is active
; (can be toggled within ZSNES by tapping Pause/Break)

Global $fPaused = True
HotKeySet("{PAUSE}", "TogglePause")

$lineLen = 25
$msBetweenKeystrokes = 35

$count = 1
While 1
   If Not $fPaused Then
      ConsoleWrite("{LALT}")

      ; Make a pseudo-progress bar so we can see visually when keystrokes are being sent
      If Mod($count, $lineLen) = 0 Then
         ConsoleWrite(@CRLF)
      EndIf

      Send("{LALT}")
      $count += 1
   EndIf
   Sleep($msBetweenKeystrokes)
WEnd

Func TogglePause()
    $fPaused = Not $fPaused
EndFunc

AutoHotkey script (works great in Windows, but has no effect in ZSNES or bsnes):

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn   ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

lineLen := 35
msBetweenKeystrokes := 35

; Press the Left Alt key repeatedly while script is active
; (can be toggled within ZSNES by tapping Pause/Break)
G_fPaused := true
Hotkey, Pause, TogglePause ; Pause/Breal

count := 1
Loop
{
    if (not G_fPaused)
    {
        ConsoleWrite("{LALT}")
        ; Make a pseudo-progress bar so we can see visually when keystrokes are being sent
        if ( 0 == Mod(count, lineLen) )
        {
            ConsoleWrite("`n")
        }
        Send {LALT}
        count += 1
    }
    Sleep, msBetweenKeystrokes
}
ExitApp, 0

TogglePause()
{
    global G_fPaused
    G_fPaused := not G_fPaused
}

ConsoleWrite(str)
{
    local
    DllCall("AllocConsole")
    ; Open the application's stdin/stdout streams in newline-translated mode
    stdout := FileOpen("*", "w")
    stdout.Write(str)
    stdout.Read(0) ; flush the buffer
    stdout.Close()
}
4
  • 1
    Doesn't ZSNES have a turbo button mapping in the controller set up? It's been a long time but I recall that used to be there in emulators. Or is that input not fast enough?
    – Sorean
    Aug 25, 2021 at 13:46
  • There is a turbo button, the tilde ~, but it's not quite what I was hoping for. Aug 25, 2021 at 14:49
  • I don't mind turbo to speed up the time passing in the game, but a turbo button the controller configuration. Some emulators have that programmed in so that if you press a different key, it increases the input in the emulator.
    – Sorean
    Aug 25, 2021 at 17:13
  • For example SNES9X (search turbo) docshare02.docshare.tips/files/26198/261983460.pdf
    – Sorean
    Aug 25, 2021 at 17:14

0

You must log in to answer this question.

Browse other questions tagged .