Jump to content
The simFlight Network Forums

Assign Mouse Commands to Joystick?


Recommended Posts

Sorry if this has already been discussed, but I couldn't find the answer after several searches.

I have a CH Products Yoke, and I'd like to assign mouse button commands "Left Click" and "Scroll Wheel Up/Down" to the hat switch on the yoke. Is this possible?

Thank you

Edited by mr_griffin
Link to comment
Share on other sites

No, not directly. In the whole life of FSUIPC (16 years now), there's actually never been one such request that I can recall.  What would you use such facilities for?

You can do it pretty easily using Lua plug-ins. There's a Mouse library supported by FSUIPC which has simple functions to click or hold / release any of the three mouse buttons, and operate the wheel both vertically and the horizontal presses where supported, as well as moving the mouse pointer, which seems rather important as a first action.

Pete

Link to comment
Share on other sites

Under " User Contribution " you can find a particular program that is doing things like that.

Mouseclicks is a general application software and not only for a Flight Simulator. MouseClicks is acting on Joystick and Keyboard.

Hope it can be of help.

 

Link to comment
Share on other sites

1 hour ago, friedrich said:

Under " User Contribution " you can find a particular program that is doing things like that.

Thanks for that. I hadn't noticed it!

How is it used to click things on screen? I don't see this clearly in the illustrations. Is it by screen or window coordinates to move the mouse to? If so how do you deal with Virtual Cockpit use, where things are rarely ever in the same place?

It's that sort of difficulty which seems to defeat the object of having a button to mouse facility. There is, or was, a program called "Key2Mouse" which folks used to use when most if not all cockpits were fixed 2D ones and you could specify coordinates of the clickable places easily. With Key2Mouse you could of course use buttons too, by assigning the buttons to the keys.

Pete

 

 

Link to comment
Share on other sites

Thanks for the suggestions! I'll look into Mouseclicks, especially.

Yea, I can see it being an unusual request; I'm using FlyInside to run FSX:SE with my HTC Vive, and it's possible to bind a joystick/keyboard button to  a "Show Mouse Cursor" action within FI. Someone at the FI forums posted an Autohotkey script that assigns mouse "left click" and "scroll wheel" to the hat, and it has worked great, but I was hoping I could run 1 less thing before firing up FSX. Not a big deal at all, though.

Practical result - don't have to take hand off the yoke and reach for invisible mouse, also trickier to aim with the mouse while using the HMD. Instead, just click a button on yoke and the mouse cursor pops up, look at button/dial you wish to interact with, then click a button on yoke to either scroll (heading bug, etc.), or flip a switch. It works really nicely, because for some reason when selecting items with head tracking like this, it's more accurate than with the mouse+head tracking. I think it's because you have 2 things you are aiming with when using the mouse (head tracking always moves cursor too), compared to 1 with just head tracking.

The dev for FI is most likely implementing the mouse left click action at some point, just figured I'd check here too.

Thanks again!

Link to comment
Share on other sites

22 minutes ago, mr_griffin said:

(head tracking always moves cursor too

Ah, that explains it. (But what is "FI" ?)

A one or two line lua plug-in for each button you want to assign would work too. You just put the Lua files into the Modules folder and assign the button to "Lua <mame of plugin>". For example, to click the left hand button:

mouse.click(0)

To scroll the wheel forward 1 click:

mouse.wheel(1)

To scroll the wheel back one click:

mouse.wheel(-1)

I think just moving the mouse makes the pointer show, so a couple of lines should do that without moving it far from its previous position:

x, y = mouse.getpos()
mouse.move(x+1, y+1)

Lua plug-ins run internally to FS of course.

Pete

 

 

Link to comment
Share on other sites

Hi Pete,

Sorry about that, I was just abbreviating FlyInside by saying "FI," I should have put it in parenthesis before switching to shorthand. 

Your method of creating simple Luas works PERFECTLY! I no longer have to use the Autohotkey script, just start the game up as normal and everything is bound the way I like it. I had never created a Lua before, but it was incredibly easy, and I was a quite surprised it worked on the first try. I really appreciate your time and help, thanks so much!

Cheers,

Griffin

Link to comment
Share on other sites

20 minutes ago, mr_griffin said:

Your method of creating simple Luas works PERFECTLY! I no longer have to use the Autohotkey script, just start the game up as normal and everything is bound the way I like it. I had never created a Lua before, but it was incredibly easy, and I was a quite surprised it worked on the first try. I really appreciate your time and help, thanks so much!

Glad it solved your problem!

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.