Tap-tap automation in SNES emulators

Tap-tap automation in SNES emulators - Colorful Toothed Wheels

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()
}





Pictures about "Tap-tap automation in SNES emulators"

Tap-tap automation in SNES emulators - A Woman Using Virtual Goggles
Tap-tap automation in SNES emulators - A Woman Using Virtual Goggles
Tap-tap automation in SNES emulators - A Man Wearing a Clear Plastic Costume





SNES9X emulator setup guide




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Digital Buggu, Michelangelo Buonarroti, Michelangelo Buonarroti, Michelangelo Buonarroti