Jump to content
LaunchBox Community Forums

How to map mouse buttons to my cabinet buttons?


Johnny T

Recommended Posts

Hi all,

I want to set up a Hidden Object Game I've got for my missus. I have created a Platform called Hidden Object Games - this platform doesn't use an emulator as the game is portable and just runs straight from the PC.

My issue is that the game is predominantly mouse controlled. 

I can use my trackball as a mouse. But I need to be able to left click the mouse and wanted to use my Player 1 Button 1 for that.

Player 1 Button 1 is currently mapped to "Left Control".

Is there a way to change this mapping to Left Mouse Click when I run the Hidden Object Game and then change it back again when I exit the game?

I've been playing around with Keyboard2XInput but that doesn't have mouse keys on it.

I've also been messing around with AutoHotKey but I'm getting myself tied up in knots?

Anyone else managed to work out how to do this?

Thanks

Link to comment
Share on other sites

What controller encoder is your cab using?  (i.e. I-Pac2)   The encoder is what has assigned P1B1 to Ctrl.  You could create a 2nd config through/for the encoder and then in LB add "Automatically run before main application" load config 2, and then "Automatically run after..." load config 1 .... for the respective games.  But that's kind of a pain.

Plan B:  In the "Running AutoHotkey script" for the emulator, add

$LCtrl::
Send, {LButton}

Problem is, every game using that emulator will be affected by that.  Though you could create a "new emulator", point it to the same exe, but add in the Run Before/Run After.

Plan C :  Create and save that AHK script and then compile it, and then add that to "Run Automatically Before..." for the games.  But off hand don't know how to make that go away after the game exits.  It's possible (and probably easy), but would need to look into it.

Plan D :   Add another button to your cab dedicated to left click.  This has been real handy on my cab, but add 3 (if you can) for Left, Middle and Right clicks.

  • Thanks 1
Link to comment
Share on other sites

6 hours ago, JoeViking245 said:

What controller encoder is your cab using?  (i.e. I-Pac2)   The encoder is what has assigned P1B1 to Ctrl.  You could create a 2nd config through/for the encoder and then in LB add "Automatically run before main application" load config 2, and then "Automatically run after..." load config 1 .... for the respective games.  But that's kind of a pain.

Plan B:  In the "Running AutoHotkey script" for the emulator, add


$LCtrl::
Send, {LButton}

Problem is, every game using that emulator will be affected by that.  Though you could create a "new emulator", point it to the same exe, but add in the Run Before/Run After.

Plan C :  Create and save that AHK script and then compile it, and then add that to "Run Automatically Before..." for the games.  But off hand don't know how to make that go away after the game exits.  It's possible (and probably easy), but would need to look into it.

Plan D :   Add another button to your cab dedicated to left click.  This has been real handy on my cab, but add 3 (if you can) for Left, Middle and Right clicks.

Joe, you are an absolute GENIUS!!!!! I can't thank you enough!!!!

Following your excellent advice (and for the benefit of others who are in the same predicament) I went down the AutoHotKey route....

I created two ahk scripts....

"hiddenobjectgamesOpen" and "hiddenobjectgamesClose"

This is the code I used...

"hiddenobjectgamesOpen"

#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.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance, Force
#Persistent

$LCtrl::
Send, {LButton}

 

"hiddenobjectgamesClose"

fullScriptPath = D:\LaunchBox\Misc Arcade Files\AutoHotKey\JTScripts\hiddenobjectgamesOpen.ahk  ; edit with your full script path
DetectHiddenWindows, On 
WinClose, %fullScriptPath% ahk_class AutoHotkey

 

I then set up my Additional Apps (right click the game and choose Edit and then click Additional Apps) to reflect these settings....

hog.thumb.png.c2147e705f699a63735ae4275c0455ab.png

The "hiddenobjectgameClose" has "Automatically run after main application" box TICKED

The "hiddenobjectgameOpen" has "Automatically run BEFORE main application" box TICKED

And that is working a treat....

I'll edit the ahk script to include the Right Click functionality as well (and any other functionality I need whilst in-game)

Again Joe... I can't thank you enough for your help.

Cheers ?

 

  • Game On 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...