Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Need help creating an AHK Mala Wrapper/Launcher for Future Pinball [SOLVED]  (Read 2778 times)

0 Members and 1 Guest are viewing this topic.

Wade007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 309
  • Last login:April 06, 2017, 01:33:35 pm
  • A MAME cabinet at home is heaven
    • bit.ly/1cWnoIC
    • Cheapskategamer.com
I'm trying to create a "Table Launcher" script that would be global for all "roms", or better stated, table title passed from Mala for Future Pinball. I need an outside launcher in order to set up my own two-button close command AND assign several keystrokes to other keys so I can have full control using my X-Arcade controller. Many keystokes can't be configured in Future Pinball preferences. I don't want to have to use a mouse or keyboard. This is for full arcade cabinet control.

I'm a beginner with Auto Hot Key and need help please!! I'm thinking there's got to be a way to get this to work, without creating an AHK file for each an every table (I got that to work that way already).

Below is my NON-working strategy and code. Please tell me where I've gone wrong.:

I've compiled my AHK file (code below) to become an .exe file so I can point my chosen frontend, Mala, to it to launch Future Pinball WITH the chosen table from the Mala gamelist. I'm just not sure how to pass the title of the chosen table onto the script so that it loads and launches the correct table each time.

In my Mala Options menu>>Other Emu Config>>Future Pinball Basics tab:
I've set the Executable as my "TableLauncher.exe" file, which is my compiled AHK file.
Rom path is pointed to my table folder. Will see files such as Superman.fpt, Dead Hunters.fpt, PinballTableX.fpt, etc.
Rom Extensions is "fpt"

Under the Execution tab>>Command line:
My command line is set to "%path%\%rom%.%.ext%".

And now finally the AHK compiled code:

SetWorkingDir, C:\Arcade\Future Pinball\
#SingleInstance force

Table=%Rom%.fpt ; This is the part I'm not sure of. How to pass the name of the table to the script variable so it loads????

Run, "Future Pinball.exe" /open "C:\Arcade\Future Pinball\Tables\%Table% /play /exit ; Is %Tables% right???
   WinWait, (c)
   WinWait, BSP
   WinWait, Software
   Sleep 500
   WinActivate, ahk_class FuturePinballOpenGL
   WinWaitClose, BSP
Ctrl::F1 ;Full Table View 1
LAlt::F2 ;Full Table View 2
Space::F3 ;Scrolling View 1
LShift::F4 ;Scrolling View 2
z::F5 ; Low Angle View 1
x::F6 ; Low Angle View 2
c::F7 ; Fixed View
5::F8 ; Special Views including Apron View
[::F11 ; Free Camera View

r::Numpad8 ;To set alternate Nudge UP control. Numpad8=Nudge Up in FP preferences.
Numpad4::d ;To set alternate Nudge Right control. D=Nudge Right in FP preferences.
g::Numpad6 ;To set alternate Nudge Left control. Numpad6=Nudge Left in FP preferences.
Numpad2::f ;To set alternate Pull control. Numpad2=Pull in FP preferences.

a::Tab
s::SendInput, {Pause} ; fixed this from my initial post. this is the proper way to remap the Pause/Break key

w::PgUp ; To set Music Volume Up
]::PgDn ; To set Music Volume Down
e::Home ; To set Sound Volume Up
6::End ; To set sound Volume Down

~2 & ~4::
Send, {ESC}
Process, Close, Future Pinball.exe
ExitAPP
return

Again, I'm just not sure how to pass and use the name of the table as the "rom name" in the script to use it to launch any table.
How does the script receive the selected table title? How can it be used to launch the unique table/game each time? How does Mala pass this info? I assumed it is passed as the name of the rom (%rom%) right?

I don't know. I'm real fuzzy on this. Please help Nitz or anyone else out there that knows more about this stuff.

Thanks in advance. :)
« Last Edit: July 06, 2012, 06:38:07 pm by Wade007 »
My Super Arcade cabinet project:
Software blog article: http://bit.ly/1cWnoIC

Hardware blog article: http://bit.ly/1dWxjvP

YouTube video: http://bit.ly/1N818Xm

Super Arcade Cabinet Progress thread (Now Complete):
http://forum.arcadecontrols.com/index.php/topic,123292.0.html

Frontend Video Intro: http://bit.ly/1P9HPDN

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Need help creating an AHK Mala Wrapper/Launcher for Future Pinball
« Reply #1 on: June 30, 2012, 11:16:13 pm »
Drop this line

Quote
Table=%Rom%.fpt

and change

Quote
Run, "Future Pinball.exe" /open "C:\Arcade\Future Pinball\Tables\%Table% /play /exit

to

Quote
Run, "Future Pinball.exe" /open "C:\Arcade\Future Pinball\Tables\%1% /play /exit

AHK asigns incoming parameters to variables named 1,2,3,etc. So this should work.

 :cheers:

Wade007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 309
  • Last login:April 06, 2017, 01:33:35 pm
  • A MAME cabinet at home is heaven
    • bit.ly/1cWnoIC
    • Cheapskategamer.com
Re: Need help creating an AHK Mala Wrapper/Launcher for Future Pinball
« Reply #2 on: July 01, 2012, 09:58:20 am »
Awesome!! Thanks for your help nitz!! I haven't tested this yet, but will do so tonight. I'll repost later.

[EDIT] I got it to work!!! The only other edit I had to make for this to work was with the command line in Mala. Options Screen/Other Emu Config/Execution/Command Line. Changed it to "%rom%.%ext%"

Now I can load any and all tables in my table folder using ONLY ONE script!!!


Now, One more minor question...
You'll notice on one of my AHK code lines I try and have the "s" key send as the "Pause|Break" key:

s::Pause

For some reason I can't get this to work. All the other keystroke assignments work find except this one. How can I get the S key to act like Pause|Break keystroke? What's wrong with my coding here?

[Edit] got this to work using the following code:

s::SendInput, {Pause}

Thanks.
« Last Edit: July 06, 2012, 06:37:08 pm by Wade007 »
My Super Arcade cabinet project:
Software blog article: http://bit.ly/1cWnoIC

Hardware blog article: http://bit.ly/1dWxjvP

YouTube video: http://bit.ly/1N818Xm

Super Arcade Cabinet Progress thread (Now Complete):
http://forum.arcadecontrols.com/index.php/topic,123292.0.html

Frontend Video Intro: http://bit.ly/1P9HPDN

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9272
  • Last login:Today at 04:11:34 pm
  • ...
Re: Need help creating an AHK Mala Wrapper/Launcher for Future Pinball
« Reply #3 on: July 02, 2012, 09:04:01 am »
AHK asigns incoming parameters to variables named 1,2,3,etc. So this should work.

Back when I first started learning how to do this stuff, I read somewhere that Mala didn't pass variables to AHK and never questioned it.  :angry:
This would have come in handy sooooo many times. 

Thanks Nitz.

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
As a caveat, I'll mention that if you wanted to pass parameters to an actual ahk script rather than a compiled exe, you would have to set your directory to wherever autohotkey is installed and send something like this to the command line:

autohotkey.exe C:\myscripts\script.ahk parameter1 parameter2

Perhaps someone tried this in Mala without specifying that .ahk files need to be run with autohotkey.exe, and then concluded that Mala can't pass variables to ahk.