Jump to content
The simFlight Network Forums

Compound buttons and key programming


DaveSCUSA

Recommended Posts

I have read the User and Advanced Guides including Appendix 1.

Can one treat key presses with compound programming as with buttons? E.g. in a 12 button keypad sending key press combination (settable) to Windows:

1=48,256,C1003,13 Keys RAlt+0 set Flag 13 (Button 1)

2=(F+0,13)49,256,K49 Keys RAlt+1 and Flag 13 is set, send 1 (Button 2 send 1 to ATC)

3=(F+0,13)49,256,C1004,13 Keys RAlt+1 and Flag 13 is set, reset Flag 13 (Button 2)

4=(F-0,13)49,256,Cxxxx,1 RAlt+1 If Flag 13 not set, set control to turn Ext Power On (Button 2)

5=(F-0,13)49,256,LELECT_EXT_INPUT1,4 RAlt+1 If Flag 13 not set, send 4 to aircraft input event turn on Ext Power

If I knew how to turn this 12 Button keypad into a joystick, I would.

Thanks

Link to comment
Share on other sites

8 minutes ago, DaveSCUSA said:

Can one treat key presses with compound programming as with buttons?

No - don't think so, but you can use offset conditions. From the Advanced User guide on key programming:

Quote

The facilities for making Button presses conditional upon assorted FS internals all apply to Key programming too, and the format and other details are the same as for Buttons. Please refer to the section above entitled “adding Offset Conditions”.

So you can use offset conditions rather than compound conditions on a button. Convert your assignments to use an offset condition, rather than a button condition.

I am only going by the documentation - try it but if it doesn't work, switch to using offset conditions.

I don't see why compound button conditions cannot be used on key press assignments though. This is maybe something I could add (if this doesn't already work) in the future.

John
 

Link to comment
Share on other sites

Sorry to bother you again but I'm a bit confused how to set an Offset, especially one I define.

In the Advanced Users, to use offsets with keypresses, it states:

"This is normally an FS control number (as in my lists), or a special FSUIPC number for additional controls. It can be in decimal, or, preceded by ‘x’ in hexadecimal. The additional FSUIPC controls range from 1000 to 3000, and also values xcc00zzzz in hexadecimal which encode the FSUIPC “Offset” controls. See list below for full details."

A bit confused by "also values xcc00zzzz in hexadecimal which encode the FSUIPC “Offset” controls".

In the Adding Offset Conditions, the example used is "31=P174,10,Cx510066C0,x00030001".  Not sure what "Cx5100" is.

In using the Key Assignments UI (see attached graphic), I selected Offset Byte Set using offset x66C0 and a parameter of 4, expecting:  1=49,24,x010066C0,4

Instead, FSUIPC7.ini contains (Choosing Tab+2 to set a control):

[Keys]
1=49,24,x01000000,x00          -{tab+1: Press=offset byte set, offset 0000 }-
2=50,24,67187,0                     -{tab+2: Press=BATTERY1_SET }-

As you suggested, I wanted to use this offset as a condition:

1=49,24,x010066C0,4             - [tab+0: Keypress Press=offset byte set, offset 66C0}- sets use ATC response

2=B66C0>0 50,24,K1              -{tab+1: Enter 1}-  as a response to ATC

3=B66C0=0 50,24,C67090,0   -{tab+1, Press=TOGGLE_EXTERNAL_POWER}-

4=50,24,x010066C0,0             - [tab+0: Keypress Press=offset byte set, offset 66C0}- reset to no ATC

 . . . . . . . . . . 

On to 10 other buttons.

I have confused myself reading in different sections of the documentation. Appendix 1 doesn't mention keypresses.

Thanks

FSUIPC7 UI Key Assignment.jpg

Link to comment
Share on other sites

8 hours ago, DaveSCUSA said:

In the Adding Offset Conditions, the example used is "31=P174,10,Cx510066C0,x00030001".  Not sure what "Cx5100" is.

From page 33:

Quote

x5100zzzz Offset Byte Cyclic Increment (offset = zzzz), hexadecimal

 

8 hours ago, DaveSCUSA said:

In using the Key Assignments UI (see attached graphic), I selected Offset Byte Set using offset x66C0 and a parameter of 4, expecting:  1=49,24,x010066C0,4

Instead, FSUIPC7.ini contains (Choosing Tab+2 to set a control):

[Keys]
1=49,24,x01000000,x00          -{tab+1: Press=offset byte set, offset 0000 }-

What you are expecting is correct. Looks like I have introduced a bug somewhere recently and the offset and parameter are not being stored correctly. I will look into this asap.

John

Link to comment
Share on other sites

34 minutes ago, John Dowson said:

What you are expecting is correct. Looks like I have introduced a bug somewhere recently and the offset and parameter are not being stored correctly. I will look into this asap.

I think the issue is that you need to click Confirm before you click OK, otherwise the offset and parameter are not read. However, there is still an issue as the key release is also being set when empty. I have corrected this in the attached version if you could try it.

John

FSUIPC7.exe

Link to comment
Share on other sites

Hello John,

It all seems to work now (at least on my test MSFS), thanks. The first time I tried the button to keypress, I received errors in attempting to send a keypress.

I set offset 0x66C0 to x04 and use it as a flag to input ATC responses. I tried to use a keypress to respond. It works from my PC keyboard but an error trying to perform a keypress from a button emulating a RAlt + 1 press. I have changed the key assignments to use the ATC controls. Not as consistent in MSFS as the actual number key.

[Keys]
1=48,264,x010066C0,x04                                                     -{ralt+0: Press=offset byte set to 4, offset 66C0 }-

10=B66C0>0 53,264,K52 << ERROR 24! Line ignored >>
11=B66C0>0 53,264,x010066C0,x00                                     -{ralt+5: Press=offset byte set to 0, offset 66C0 }-

Changed to:

1=48,264,x010066C0,x04                                                     -{ralt+0: Press=offset byte set to 4, offset 66C0 }-

10=B66C0>0 53,264,66175,1                                               -{ralt+5: Press=ATC_MENU_4 }-
11=B66C0>0 53,264,x010066C0,x00                                    -{ralt+5: Press=offset byte set to 0, offset 66C0 }-

Thanks for your input

Link to comment
Share on other sites

On 12/13/2023 at 1:04 PM, DaveSCUSA said:

Hello John,

It all seems to work now (at least on my test MSFS), thanks. The first time I tried the button to keypress, I received errors in attempting to send a keypress.

I set offset 0x66C0 to x04 and use it as a flag to input ATC responses. I tried to use a keypress to respond. It works from my PC keyboard but an error trying to perform a keypress from a button emulating a RAlt + 1 press. I have changed the key assignments to use the ATC controls. Not as consistent in MSFS as the actual number key.

[Keys]
1=48,264,x010066C0,x04                                                     -{ralt+0: Press=offset byte set to 4, offset 66C0 }-

10=B66C0>0 53,264,K52 << ERROR 24! Line ignored >>
11=B66C0>0 53,264,x010066C0,x00                                     -{ralt+5: Press=offset byte set to 0, offset 66C0 }-

Changed to:

1=48,264,x010066C0,x04                                                     -{ralt+0: Press=offset byte set to 4, offset 66C0 }-

10=B66C0>0 53,264,66175,1                                               -{ralt+5: Press=ATC_MENU_4 }-
11=B66C0>0 53,264,x010066C0,x00                                    -{ralt+5: Press=offset byte set to 0, offset 66C0 }-

Thanks for your input

I didn't receive an answer from the last post above. Can a key press assignment create a keypress?

Link to comment
Share on other sites

5 minutes ago, DaveSCUSA said:

I didn't receive an answer from the last post above

Sorry, but I didn't/don't see a question there...

5 minutes ago, DaveSCUSA said:

Can a key press assignment create a keypress?

Yes, by using the key press/release controls - from page 28 of the Advanced User guide:

       1070 Key Press and Release (param is Keycode + Shift code (i.e. enter with + symbol, not calculate), or JsBk)
       1071 Key Press/Hold (param is Keycode + Shift code( i.e. enter with + symbol, not calculate), or JsBk)
       1072 Key Release (param is Keycode + Shift code (i.e. enter with + symbol, not calculate), or JsBk)

Those controls should be available from the assignments drop-down menu when using standard FS controls (i.e. not presets or Input Events).

John

Link to comment
Share on other sites

On 12/13/2023 at 1:04 PM, DaveSCUSA said:
1 hour ago, John Dowson said:

Sorry, but I didn't/don't see a question there...

Thanks, wouldn't have caught the keypress controls. Don't need to use the FSUIPC added controls. I assume if you don't need a shift code just leave it and the + sign off and just use the Keycode alone.

Sorry, the question was implied, why the error? I guess the answer is that "K" is not valid with keypress assignments.

PS What does "JsBk" mean?

 

Link to comment
Share on other sites

Please don't embed new questions in quoted text - it makes it very difficult to see what you are actually saying.

27 minutes ago, DaveSCUSA said:

Don't need to use the FSUIPC added controls.

But you obviously do! You are already using the offset controls, which are also added by FSUIPC. There is no distinction in the drop-downs between FS-defined controls and those added by FSUIPC.

29 minutes ago, DaveSCUSA said:

I assume if you don't need a shift code just leave it and the + sign off and just use the Keycode alone.

Use '..+8', as 8 is 'normal', i.e. no shifts.

30 minutes ago, DaveSCUSA said:

why the error? I guess the answer is that "K" is not valid with keypress assignments.

No it is not. Please see the Advanced User manual on the definition of key controls. The 'K...' syntax is for the key you are programming, not what the key is sending. Don't invent your own syntax and expect it to be valid.

32 minutes ago, DaveSCUSA said:

PS What does "JsBk" mean?

Yes, that is confusing, and I am not even sure it is even valid, That syntax is for joystick buttons. I will update the manuals and remove.

Please note that I am now on holiday until the new year. Any more questions will have to wait until then.

John

Link to comment
Share on other sites

14 hours ago, DaveSCUSA said:

Can a keypress have 2 offset conditions?

No. If its not document, you cannot do it. As I have already said, you cannot invent your own syntax and expect it to work. Please consult the documentation for such issues. Or just try it - you will see that you get an error.

 

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.