Jump to content
The simFlight Network Forums
Sign in to follow this  
brauner1

Multiple functions for a single key

Recommended Posts

Im trying to initiate an lua script, 2 offsets and an action using a single key press.

Ive already defined the various functions using the UI, assigning each to a different keyboard key. However editing the .ini, it simply seems to delete any function edited to an already associated key.

Share this post


Link to post
Share on other sites
3 hours ago, brauner1 said:

Ive already defined the various functions using the UI, assigning each to a different keyboard key. However editing the .ini, it simply seems to delete any function edited to an already associated key.

Why are you trying to edit the INI file to do this? You are problably making an error in the encoding. The way to do it is simply assign they keypress in the Key assignments menu!

In the INI you can add extra assignments to existing assignments, for multiple actions on the same key, but you muat get the format correct.  If you are actually getting them deleted you are probably using the same line/parameter number -- the number before the =. That's the reference used by Windows to retrieve the parameters, and needs to be unique withon each section.

Pete

 

Share this post


Link to post
Share on other sites

The UI only allows one action per key press, as any previous one gets overwritten. How would a multi function assignment look like in ini?

Share this post


Link to post
Share on other sites
4 hours ago, brauner1 said:

The UI only allows one action per key press, as any previous one gets overwritten. How would a multi function assignment look like in ini?

The same as a single assignment, but with a different entry number (the value before the =) and obviously a different keycode or control number, or whatever.

They are actioned in ascending order of the entry numbers.

There are examples in the Advanced User's guide, as well as a list of keycodes and FSUIPC-added controls. For normal FS controls there's the list in your FSUIPC Documents folder, inside the Modules folder.

Oh, and you can have two actions on a keypress - one for the 'press' and one for the 'release', and sometimes that's enough, and appropriate because you know they'll always be executed in that order.

Pete

 

Share this post


Link to post
Share on other sites
6 hours ago, brauner1 said:

The UI only allows one action per key press, as any previous one gets overwritten. How would a multi function assignment look like in ini?

Here is a portion of my INI that shows multiple assignments for some switches.

Lines 0 and 1 show switch 14 opening both cockpit sliding windows in thw A2A L049.

Lines 2 and 3 use switch 15 to close both windows.

I use letters instead of numbers for the Joy Num..."D" and "A" here. The B66C0=0 part of the entries is a conditional assignment that allows me to have multiple assignments for controls based on the value in User Defined Offset 0x66C0. In this case these statements are operable when that value is 0 (Control Set 0). I also use my joystick pinky switch to allow  further assignments for  Control Set 0. ( -C,6) and (+C,6). Unshifted and shifted....Pinky open and Pinky closed.

[Buttons.Lockheed Constellation L049]
-{========================================================================}-
!1=-{CONTROL SET 0 - WINDOWS, APU - AP COMTROLS - PANELS SHIFTED}-
0=B66C0=0 CP(-C,6)D,14,CM25:43,100 	-{Macro A2A_L049: L:WindowSliding1Lever set}-
1=B66C0=0 CP(-C,6)D,14,CM25:44,100 	-{Macro A2A_L049: L:WindowSliding2Lever set}-
2=B66C0=0 CP(-C,6)D,15,CM25:43,0 	-{Macro A2A_L049: L:WindowSliding1Lever set}-
3=B66C0=0 CP(-C,6)D,15,CM25:44,0 	-{Macro A2A_L049: L:WindowSliding2Lever set}-
4=B66C0=0 CP(-C,6)D,16,CM25:21,0 	-{Macro A2A_L049: L:ApuStarterGenSwitch tgl}-
5=B66C0=0 CP(-C,6)D,17,CM25:47,2 	-{Macro A2A_L049: L:ApuStarterGenSwitch set}-
6=B66C0=0 CR(-C,6)D,18,CM25:122,100 	-{Macro A2A_L049: L:ApAileronControl inc}-
7=B66C0=0 CR(-C,6)D,19,CM25:123,-100 	-{Macro A2A_L049: L:ApAileronControl dec}-
8=B66C0=0 CR(-C,6)A,0,CM25:120,100 	-{Macro A2A_L049: L:ApElevatorControl inc}-
9=B66C0=0 CR(-C,6)A,1,CM25:121,-100 	-{Macro A2A_L049: L:ApElevatorControl dec}-
10=B66C0=0 CR(-C,6)A,2,C65879,0 	-{HEADING_BUG_INC}-
11=B66C0=0 CR(-C,6)A,3,C65880,0 	-{HEADING_BUG_DEC}-
-{========================================================================}-
!37=-{CONTROL SET 0 SHIFTED - PANELS - AP SERVOS}-
370=B66C0=0 CP(+C,6)D,14,C66506,14992 	-{PANEL_ID_TOGGLE}-
371=B66C0=0 CP(+C,6)D,15,C66506,440 	-{PANEL_ID_TOGGLE}-
372=B66C0=0 CP(+C,6)D,16,C66506,1064 	-{PANEL_ID_TOGGLE}-
373=B66C0=0 CP(+C,6)D,17,C66506,225 	-{PANEL_ID_TOGGLE}-
374=B66C0=0 CP(+C,6)D,18,CM25:110,1 	-{Macro A2A_L049: L:ApAileronServoOn set}-
375=B66C0=0 CP(+C,6)D,19,CM25:110,0 	-{Macro A2A_L049: L:ApAileronServoOn set}-
376=B66C0=0 CP(+C,6)A,0,CM25:111,1 	-{Macro A2A_L049: L:ApElevatorServoOn set}-
377=B66C0=0 CP(+C,6)A,1,CM25:111,0 	-{Macro A2A_L049: L:ApElevatorServoOn set}-
378=B66C0=0 CP(+C,6)A,2,CM25:112,1 	-{Macro A2A_L049: L:ApRudderServoOn set}-
379=B66C0=0 CP(+C,6)A,3,CM25:112,0 	-{Macro A2A_L049: L:ApRudderServoOn set}-
-{========================================================================}-

Here is a more complex implementation for the engine start of the A2A B-17G. When an engine is selected for  start, the start switch is activated, the fire extinguisher selector is set to that engine and the primer pump selector switch is set to that engine.

Look at the entries for switches 14,  16, 18 and 0 for those functions. Switch 2 clears several functions.

Note that I had inserted comments originally and when Pete added the automatic comments feature, they were appended to my comments. in this example.

!2=//SET 2 STARTERS ENG 1 - 4 CLEAR START & MESH SET 4 PRIMER & PUMP - ALL MACROS
20=B66C0=1 PD,14,CM6:5,0 ;//STARTER ENG 1 - SET PRIMER TO ENG 1 MACRO 	-{Macro A2A_B17G: L:Starter12Start set}-
21=B66C0=1 PD,16,CM6:5,2 ;//STARTER ENG 2 - SET PRIMER TO ENG 2 MACRO 	-{Macro A2A_B17G: L:Starter12Start set}-
22=B66C0=1 PD,18,CM6:6,2 ;//STARTER ENG 3 - SET PRIMER TO ENG 3 MACRO 	-{Macro A2A_B17G: L:Starter34Start set}-
23=B66C0=1 PA,0,CM6:6,0 ;//STARTER ENG 4 - SET PRIMER TO ENG 4 MACRO 	-{Macro A2A_B17G: L:Starter34Start set}-
24=B66C0=1 PD,15,CM6:7,0 ;//MESH ENG 1 	-{Macro A2A_B17G: L:Starter12Mesh set}-
25=B66C0=1 PD,17,CM6:7,2 ;//MESH ENG 2 	-{Macro A2A_B17G: L:Starter12Mesh set}-
26=B66C0=1 PD,19,CM6:8,2 ;//MESH ENG 3 	-{Macro A2A_B17G: L:Starter34Mesh set}-
27=B66C0=1 PA,1,CM6:8,0 ;//MESH ENG 4 	-{Macro A2A_B17G: L:Starter34Mesh set}-
28=B66C0=1 PA,2,CM6:5,1 ;//CLEAR STARTER 1/2 	-{Macro A2A_B17G: L:Starter12Start set}-
29=B66C0=1 PA,2,CM6:6,1 ;//CLEAR STARTER 3/4 	-{Macro A2A_B17G: L:Starter34Start set}-
30=B66C0=1 PA,2,CM6:7,1 ;//CLEAR MESH 1/2 	-{Macro A2A_B17G: L:Starter12Mesh set}-
31=B66C0=1 PA,2,CM6:8,1 ;//CLEAR MESH 3/4 	-{Macro A2A_B17G: L:Starter34Mesh set}-
32=B66C0=1 PA,2,CM6:30,0 ;//SET PRIMER SELCT TO OFF 	-{Macro A2A_B17G: L:PrimerSel set}-
33=B66C0=1 PA,3,CM6:31,1 ;//ACTIVATE PRIMER 	-{Macro A2A_B17G: L:PrimerOn tgl}-
34=B66C0=1 PD,14,CM6:30,1 ;//SET PRIMER SELCT TO ENG 1 	-{Macro A2A_B17G: L:PrimerSel set}-
35=B66C0=1 PD,16,CM6:30,2 ;//SET PRIMER SELCT TO ENG 2 	-{Macro A2A_B17G: L:PrimerSel set}-
36=B66C0=1 PD,18,CM6:30,3 ;//SET PRIMER SELCT TO ENG 3 	-{Macro A2A_B17G: L:PrimerSel set}-
37=B66C0=1 PA,0,CM6:30,4 ;//SET PRIMER SELCT TO ENG 4 	-{Macro A2A_B17G: L:PrimerSel set}-
38=B66C0=1 PD,14,CM6:37,1 ;//SET FIRE EXT. SWITCH TO ENG 1 	-{Macro A2A_B17G: L:FireEngineSelected set}-
39=B66C0=1 PD,16,CM6:37,2 ;//SET FIRE EXT. SWITCH TO ENG 2 	-{Macro A2A_B17G: L:FireEngineSelected set}-
40=B66C0=1 PD,18,CM6:37,3 ;//SET FIRE EXT. SWITCH TO ENG 3 	-{Macro A2A_B17G: L:FireEngineSelected set}-
41=B66C0=1 PA,0,CM6:37,4 ;//SET FIRE EXT. SWITCH TO ENG 4 	-{Macro A2A_B17G: L:FireEngineSelected set}-
42=B66C0=1 PA,2,CM6:37,0 ;//SET FIRE EXT. SWITCH TO OFF 	-{Macro A2A_B17G: L:FireEngineSelected set}-

Hope this gives you an idea as how to proceed with multiple assignments for a controller button/switch.

Paul

Share this post


Link to post
Share on other sites

A more practical quetion:

20=N48,8,x4200088E,xC1805014  -{0: Press=offset sword decrement, offset 088E (Decr=20500, Limit=-16000) }-
21=N189,8,x42000926,xC1805014  -{-_key: Press=offset sword decrement, offset 0926 (Decr=20500, Limit=-16000) }-

How can "0" be used to operate both offsets?

Share this post


Link to post
Share on other sites
1 hour ago, brauner1 said:

20=N48,8,x4200088E,xC1805014  -{0: Press=offset sword decrement, offset 088E (Decr=20500, Limit=-16000) }-
21=N189,8,x42000926,xC1805014  -{-_key: Press=offset sword decrement, offset 0926 (Decr=20500, Limit=-16000) }-

How can "0" be used to operate both offsets?

The "0" keycode is 48 (as listed in the Advanced User guide), so in your 20= assignment, the 0 is the 48. The 8 just means "on its own, no shift, CTRL, ALT or TAB added".

All this is in the Advanced Users guide, which is provided for your reference on things like this.

Pete

 

Share this post


Link to post
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

Sign in to follow this  

×