Jump to content
The simFlight Network Forums

Conditional Keypress Trapping?


Recommended Posts

Hi Pete,

 

I'm trying to find a way to make FSUIPC keypress trapping conditional, or "seem" conditional. I use FSUIPC key assignments to control a Lua application, and thus these keys are trapped by FSUIPC. But based on a condition within the application, I would like the associated keypress (key code) passed onto FSX for normal processing, thus in effect implementing what looks like conditional keypress trapping by FSUIPC. The keypress parameter could be used to identify the key to the Lua application, so I guess the critical question is whether or not there's a way to have the Lua program pass a key code to FSX. Does this seem feasible, or am I way off base here in my thinking?

 

Thx,

Al

Link to comment
Share on other sites

Hi,

 

If you use the event.key function trigger, you get the keycode, shift and downup as parameters. So whatever key was pressed you could react in your LUA function triggered by this event. Lua library manual page 23. No need to use the FSUIPC key assignment in that case. You trap the key directly in the LUA.

 

Rgds

Reinhard

Link to comment
Share on other sites

Reinhard,

 

 I'm not sure the event.key trigger will meet my needs, but will certainly look into it.

 

In my application, once the user sends the "Off key" to the Lua app, all subsequent app control keys need to be simply passed onto FSX for normal processing until the app receives the "On key".  This is complicated by the fact that each user defines what set of keys they want to use for app control (although they currently do have to use appropriate keypress parameters associated with each control function).

 

In any case,  thanks very much for the suggestion.

 

Al

Link to comment
Share on other sites

In my application, once the user sends the "Off key" to the Lua app, all subsequent app control keys need to be simply passed onto FSX for normal processing until the app receives the "On key".  This is complicated by the fact that each user defines what set of keys they want to use for app control (although they currently do have to use appropriate keypress parameters associated with each control function).

 

Event trapping in Lua can be cancelled too. And it is pretty easy for a Lua program to read some sort of parameter file f that's the way you want the keys defined.

 

On your original post:

 

 I guess the critical question is whether or not there's a way to have the Lua program pass a key code to FSX

 

Yes, of course. ipc.keypress or ipc.keypressplus.

 

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.