Jump to content
The simFlight Network Forums

Keyboard Sequence for sim action in FSX


Recommended Posts

Hello, 

I'm new at FSUIPC button mapping and programming and wanted to reach out for some help. I would like to create a keyboard sequence (X+1) to toggle on/off beacon lights. How would I go about doing this for FSX:A with a registered version of FSUIPC? I have read through the advanced programming file and couldn't figure it out. I tried to map the button (X+1) on the button press section within fsuipc while fsx was running it would only take X, and not the combo X+1 from the keyboard.

I have also tried to add [KEYS] section in the INI file but couldn't get it to work. I added the line

0=8841,8,66XXX(the number from the FS list for toggle beacon light), but that didn't work either. 

Any help teaching me this stuff will be highly appreciated. 

Link to comment
Share on other sites

In that case, is there any tutorial on how to make a lua script for that I'm trying to do? I want to have to have the keyboard key press sequence X+1 to toggle on/off beacon light.

How do I even begin making a lua script? Sorry for all these questions, I'm new at this but I'm willing to learn and figure this out.   

Link to comment
Share on other sites

20 hours ago, anchit02 said:

I would like to create a keyboard sequence (X+1) to toggle on/off beacon lights. How would I go about doing this for FSX:A with a registered version of FSUIPC? I have read through the advanced programming file and couldn't figure it out. I tried to map the button (X+1) on the button press section within fsuipc while fsx was running it would only take X, and not the combo X+1 from the keyboard.

What is "X+1"?  Do you mean a sequence, "X", "+", "1"?  What exactly is each keypress supposed to do?

Are these default FS beacon lights?

20 hours ago, anchit02 said:

0=8841,8,66XXX(the number from the FS list for toggle beacon light), but that didn't work either.

Key 8841?  That's a very strange number.  How do you arrive at that? It certainly isn't a valid keycode.

Anyway, the correct format would be

0=keycode, shiftcode, 66239, 0

If you needed a parameter like '1' replace the 0 by 1. But i don't think the parameter does anything for a "Toggle" control, which that is.

And instead of trying to edit the [KEYS] section in the INI, just assign the keypress in the normal way, in the Keys tab in FSUIPC Options. The INI parameters are generated, correctly, for you!

Pete

 

  • Like 1
Link to comment
Share on other sites

Thank you so much for your reply sir.

To clarify, what i meant by "X+1" is the holding the button "X" and button "1" (one over the Q key and not number pad). Once these 2 keys are pressed together, I want FSUIPC to toggle beacon lights on/off.

And yes, it is default FS beacon light (code 66239).

What I am trying to achieve is as follows:

Map key stroke X+1 to beacon light, then set X+1 as a macro for my logitech G110 keyboard's macro switch G5 using the logitech software. 

I can do this just fine using landing lights and strobe lights using FS default controls under the lights section, and assigning the X+1 keyboard switch there, then adding the X+1 as a macro for the programmable switches on the keyboard using the logitech software.

But unfortunately the default FSX controls does not have any option for beacon lights but FSUIPC does, so I was wondering how I could get similar results with FSUIPC's help.  

So, can you help me do this? Or is it too silly to do with FSUIPC? 

Link to comment
Share on other sites

1 hour ago, anchit02 said:

To clarify, what i meant by "X+1" is the holding the button "X" and button "1" (one over the Q key and not number pad). Once these 2 keys are pressed together, I want FSUIPC to toggle beacon lights on/off.

Ah, so I understood it the wrong way around. i thought you wanted X and 1 to go to the Sim.

Sorry, but X is not a "shift" character. FSUIPC can only have its list of "shifts" simultaneously recognised. These are extended and should be ample:

Shift, Ctrl, Win and Tab. (Alt could be used, but is precarious as it invokes FS's menu bar).

1 hour ago, anchit02 said:

I can do this just fine using landing lights and strobe lights using FS default controls under the lights section, and assigning the X+1 keyboard switch there,

Sorry,  that sounds unlikely! Are you saying FS does really accept multiple text key presses for the one assignment? I'd like to see how it manages to record those. And recognising multiple text characters pressed at the same time is relatively complex. Each text character sends a WM_CHAR message and it is that which is normally used. To detect them being presse and released means monitoring WM_KEYDOWN and WM_KEYUP messages which only give keycodes, not the ASCII character derivation, though that can be derived by yet more Windows calls. FSUIPC does this sort of thing for the Lua plug-in keypress and detection programming, but it isn't a normal process.

1 hour ago, anchit02 said:

But unfortunately the default FSX controls does not have any option for beacon lights but FSUIPC does,

Really?  That's rather a bad omision on MS/DTG\LMs part!

If you are using P3D I think you should point out that omission to LM. (Too late for FSX/FSX-SE).

Meanwhile, I think you would be best choosing a more normal keypress combination.

Pete

 

  • Like 1
Link to comment
Share on other sites

Thank you sir, I will try using a normal key press for the the beacon lights.

In terms of FS accepting multiple text keys, yes! I am sure it does. You can see my screenshots of it working in this file.

And I am on FSX:Acceleration, so cant reach out to anyone for adding beacon lights and such in the controls.  

Capture1.rar

Link to comment
Share on other sites

Using just alphabets and number, you can have max of 2 on FSX. Eg C+3, X+A,...

Using "Shift" keys (Shift,Ctrl,Alt,Tab) you can have max of 3 on FSX. Eg Shift+X+A, Tab+3+A

I've also tested and checked that the order matters for these sequence keys,

Eg: X+A => Strobe Light; A+X=>Landing light, this actually works in FSX. So If i press X first then press A, it toggles default FSX Strobe, and also A first then X sill toggle default FSX Landing lights. Hope this helps.

Also, I was hoping to set up my X52Pro controller from Saitek with bit more functionality with modes. Should I open a new topic for that?

 

Link to comment
Share on other sites

2 hours ago, anchit02 said:

So If i press X first then press A, it toggles default FSX Strobe, and also A first then X sill toggle default FSX Landing lights. Hope this helps.

Ah, so they are sequences, not combinations.

In that case it's a lot easier to do in Lua, as you can make the plug-in act on successive keypresses thus:

When X is pressed, make it run a Lua program which simply tests if global vatiable "A" is set, and if so send the control for X then A and clear global A. If not simply set global variable X.

Same for when A is pressed, but the other way around.

Of course for you to be able to use A or X on their own you'd have to actually make it event driven, so pre-loaded, and timeout the arrival of the complementary keypress then clear the relevant global(s).  Actually it would be better being event driven as then it wouldn't be so time critical about how fast you pressed the two keys.

However it's an awful  lot of trouble to go to when you have about 1600 other easy straight assignable key combinations (over 100 normal keys with all possible combinations of the 4 allowed shift keys, excluding ALT). Even if you remove the 100 or 200FS pre-assigned ones, there's still a lot to choose. Why would anyone resort to two successive key presses?

Pete

 

  • Like 1
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.