Keyboard input into MAME

Ask gaming related questions (AHK v1.1 and older)
mikey52
Posts: 4
Joined: 11 May 2022, 08:26

Keyboard input into MAME

Post by mikey52 » 18 May 2022, 19:56

So my assumption is easy enough. Send directional input into Pacman via MAME.
Only reason I am doing this is as a challenge to myself to simply see if it can be done.
So far nothing happens. Mame ignores this. I tried automatically sending the '5' key as a 'coin-insertion', then '1' to start the game. Wait 4 seconds for opening tune and an additional 3 seconds for the Pacman to auto-move left before sending the DOWN arrow.

But nothing happens at all. I have tried changing the activation key, compiling it into an exe and running as administrator. Nothing helps.

While I am not new to scripting I am brand new to scripting for games (I am a Powershell / VBscript / GAM person - ALL work related stuff).

Would like any help with this.

Code: Select all

]::
IfWinActive ahk_exe MameUI32.exe
sleep, 1000
Send 5
sleep, 1000
Send 1
sleep, 4000
sleep,3000
send {Down}
return
[Mod edit: [code][/code] tags added.]

User avatar
mikeyww
Posts: 26869
Joined: 09 Sep 2014, 18:38

Re: Keyboard input into MAME

Post by mikeyww » 18 May 2022, 20:45

Welcome to this AutoHotkey forum!

I do not have MAME, but my suggestion is, since your script does not work, try a simpler one: see if you can send a single key. Test in Notepad first. If it works there, test in your target program.

Code: Select all

]::
SetKeyDelay,, 25
Send 5
Return

mikey52
Posts: 4
Joined: 11 May 2022, 08:26

Re: Keyboard input into MAME

Post by mikey52 » 20 May 2022, 08:20

I can send text input, such as a text box or console. This is easy.
5 key could be adding a virtual 'quarter' and following up by '1' key would be the start game key
Sending directional or control keys into another program is the thing which fails for me.
MAME is an arcade emulator and my learning project is to run a pacman maze via script.

User avatar
mikeyww
Posts: 26869
Joined: 09 Sep 2014, 18:38

Re: Keyboard input into MAME

Post by mikeyww » 20 May 2022, 09:03

OK. Sorry if I do not have the specific answer to that. I did notice a lot of other posts about MAME, so perhaps someone figured it out earlier?

Post Reply

Return to “Gaming Help (v1)”