Jump to content
The simFlight Network Forums

Reality XP GNS 430 - FSUIPC


Recommended Posts

Hi Pete,

All of the mouse-controlled functions on a Reality XP GNS can be mapped to a combination of keystrokes so I have coded a simple Lua program to map these mouse actions to a set of rotary encoders and switches. All works great except for two functions which have time-dependent responses, ie press momentarily for one action or hold for 2 seconds for another. However, it appears that the response from my Lua file (I'm using ipc.keypressplus with 0 for press/release to detect the controller button) is always that of the held action. Is it possible for me to get the momentary action response?

Also, can you explain the concept of "focus" in the context of ipc.keypressplus, is this relevant to my problem?

Many thanks for any help.

Best regards

Link to comment
Share on other sites

All of the mouse-controlled functions on a Reality XP GNS can be mapped to a combination of keystrokes so I have coded a simple Lua program to map these mouse actions to a set of rotary encoders and switches.

Why can't you assign the encoders and swtches directly to the keystroke combinations?

All works great except for two functions which have time-dependent responses, ie press momentarily for one action or hold for 2 seconds for another. However, it appears that the response from my Lua file (I'm using ipc.keypressplus with 0 for press/release to detect the controller button) is always that of the held action. Is it possible for me to get the momentary action response?

Sorry, I don't understand. How does using keypressplus detect a controller button? And how is it taking two seconds?

Also, can you explain the concept of "focus" in the context of ipc.keypressplus, is this relevant to my problem?

Why would you be using keypressplus in any case if it were not for the focus issue? The only other use of it is to get keypresses sent to FS menus, which are otherwise modal so preventing normal FSUIPC actions like sending keypresses.

Keyboard focus merely refers to the window which currently receives keypresses. It has the user's focus. Since I don't know why you are using Lua I can't say what is up with what you are trying to do. I would have thought the best way to program buttons and rotaries to send keypresses was to just assign them. Your momentary or 2 second hold is achieved then by the repeat whilst held option.

In general, for a Lua program, a button press action can be timed and different actions resulting quite easily. Simply have the button push start the Lua and the button release set a flag for that Lua (LuaSet ...). In the Lua code you read the elapsed time, then loop till you see the flag, then read the time again. Act according to the difference. You can of course have a limit on the loop to, for example, exit after 2 seconds in any case.

Perhaps if you showed your Lua code it might make it easier for me to understand what and why you are doing what it is you are doing?

Regards

Pete

Link to comment
Share on other sites

Hi Pete,

Many thanks for the prompt reply.

The mouse actions are equivalent to key combinations of the form ctrl+shift+win+A (or B or C etc). I had difficulty directly setting a button to combinations like this. Is this possible?

The alternative approach I used in the Lua file was to detect the button (event.button) which I am setting to the mouse action I want to emulate and use this to call a lua function which uses ipc.keypress to send the appropriate key combination to FS,

eg for ctrl+shift+win+C I use

function button1( )

ipc.keypressplus(67,43)

ipc.display(" Button activated ",2)

end

I was assuming that keypressplus was equivalent to a "press and release" key action.

In the mouse action that I trying to emulate with buttons, clicking the on-screen hotspot gives one response while clicking and holding gives a different response.

Best regards

Link to comment
Share on other sites

The mouse actions are equivalent to key combinations of the form ctrl+shift+win+A (or B or C etc). I had difficulty directly setting a button to combinations like this. Is this possible?

Yes. There should be no difficulty. All of the shifts usable in Lua are also usable in the assignments -- the same core routines are used by both in any case. What was the difficulty? I just tried assigning a button to "ctrl+shift+win+A" and it worked fine.

I was assuming that keypressplus was equivalent to a "press and release" key action.

Well that's what the normal ipc.keypress function does. The ipc.keypressplus was added for two things only:

1. To try to get keys pressed whilst in FS menus or dialogues where FSUIPC is normally halted because of the modal nature of the dialogue, and

2. To optionally move the keyboard focus to FS and afterwards back to the original owner, for use when sending keypresses to external programs.

For your use "keypress" is quite adequate and normal.

In the mouse action that I trying to emulate with buttons, clicking the on-screen hotspot gives one response while clicking and holding gives a different response.

If it works with assigned keypresses from the real keyboard there's no reason I can think of that it won't work with keypresses assigned to buttons in FSUIPC.

Regards

Pete

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.
Note: Your post will require moderator approval before it will be visible.

Guest
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.

Loading...
 Share

×
×
  • 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.