Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi John,

I'm using FSUIPC7 ver 7.3.6 and can no longer get sending keystrokes with a button push to work. I'm not sure when this started, but Lua scripts that worked with this are not too long ago (few weeks or less) are no longer working. All looks normal in the FSUIPC7 buttons tab when I push a button, and the scripts work if I send the keystrokes using the keyboard, but the scripts are not responding to the corresponding button pushes. Very strange. I've tried reinstalling FSUIPC7 but that didn't help.

Appreciate any ideas?

Thanks,

Al

Posted

Hi Al,

you have asked for support so many times now, I don't understand why I still have to ask to see your FSUIPC7.ini and FSUIPC7.log files for such questions...
Please show them to me, the latter with logging for Buttons & Keys as well as Events activated, and where you have pressed such an assigned button.

It certainly is working, as that is how my POV is assigned and I certainly would have noticed if that wasn't working...

John

Posted

 

On 6/22/2022 at 12:48 PM, John Dowson said:

It certainly is working, as that is how my POV is assigned and I certainly would have noticed if that wasn't working...

I did some more testing. What is working is I can send a key sequence to the sim from a button push and get the expected response.  What is not working is activating a lua script by sending a key sequence from a button push. I have tried buttons on different controllers, sending different key strokes, to different Lua scripts -- none work.

In the attached files I tried 3 times to use Btn#2 on my saitek TQ to send the key sequence lctl+X to activate TestScript.lua.  Sending the key strokes directly from the keyboard works. Pushing the button while in the FSUIPC7 Buttons and switches tab also "works" -- that is, the fields are filled in correctly by FSUIPC7 in response to the button. But in the sim, the associated lua script does not run when the button is pushed

Of course I can always activate a script "directly" by using the right side of the Buttons and switches window (send for FS control), but I have some scripts that I like to be able to activate from either a button or the keyboard, and so to keep things consistent I use the button to send the key strokes.

The question is why can't I activate a lua script by using a button to send a key stroke -- it did work previously, so what have I messed up?

Thanks,

Al

FSUIPC7.log

 

 

Posted
3 hours ago, ark1320 said:

What is not working is activating a lua script by sending a key sequence from a button push.

But why do you want to do this? The lua plugin should be started directly in the button push.

3 hours ago, ark1320 said:

Of course I can always activate a script "directly" by using the right side of the Buttons and switches window (send for FS control),

Yes!

3 hours ago, ark1320 said:

but I have some scripts that I like to be able to activate from either a button or the keyboard, and so to keep things consistent I use the button to send the key strokes.

The question is why can't I activate a lua script by using a button to send a key stroke -- it did work previously, so what have I messed up?

Nothing is messed up. I removed acting on key requests sent from FSUIPC that are then received from FSUIPC some time ago. I did this as this causes a circular issue problem.. Keys received by FSUIPC directly (i.e. when FSUIPC has the focus) are send to the FS. Keys pressed when MSFS are received by FSUIPC and acted upon. If FSUIPC sends keys to FSUIPC, it also receives the key presses back - id it acted upon them it would also send them back to the FS, which would then forward them back to FSUIPC and the loop would continue.

I could add  a ne flag/ini parameter to allow this, but I would not advise this as this could cause this circular loop. I allowed this in earlier versions, but noticed this circular problem and so removed this. If you want me to add a flag to allow this, then I can do that, but you would use at your own risk.

Another issue when sending keys is with using modifiers (shift, alt. ctrl, etc). Such keys are not received from MSFS - the keyboard is scanned to see what modifiers are used when the primary key is received. This means that if you send a key combination with a modifier to the FS, then only the main key (and not the modifier) will be received.

This recent post on key handling may be of interest: 

 

John

Posted
6 hours ago, John Dowson said:

I could add  a new flag/ini parameter to allow this, but I would not advise this as this could cause this circular loop.

I certainly accept your judgement on this, no need to change anything for me. What had mislead me a bit was I looked "back" at P3dv5, which I still use, and using a button to send key strokes to activate a lua script still works. Of course, a different sim has different considerations.

Thanks for the explanation,

Al

Posted
7 hours ago, John Dowson said:

This means that if you send a key combination with a modifier to the FS, then only the main key (and not the modifier) will be received.

If I understand this correctly, if for example  FSUIPC7 sends the keystrokes Shift + M to the sim, MSFS only sees the M.

That is certainly good to know. Thanks!

Al

Posted
38 minutes ago, ark1320 said:

If I understand this correctly, if for example  FSUIPC7 sends the keystrokes Shift + M to the sim, MSFS only sees the M.

No! It will send what you request. BUT, if FSUIPC were to receive that keypress back, it would only receive the M key (as it scans the keyboard on key reception to check for modifier keys.

56 minutes ago, ark1320 said:

What had mislead me a bit was I looked "back" at P3dv5, which I still use, and using a button to send key strokes to activate a lua script still works. Of course, a different sim has different considerations.

Yes, but this is still a strange way of doing this...why don't you just assign the key press in FSUIPC to start the lua script? Far easier....

John

  • Like 1

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.