Jump to content
The simFlight Network Forums

New key programming section for every paint?


Recommended Posts

Hi Pete,

Me again. I try to make some programming for my airplanes, however, I have still difficulties with the aircraft specific sections: if an aircraft.cfg

contains 3 different paints and I want to fly them all three, do I have to specify a section for each paint ? or can I use some shortcut in the specification ? Until now I found out that I have to specify a section for each paint, until the opposite is proved.

BTW A programming trick:

If you have to toggle a button with two different commands:

33=CP(+0,6)(+0,7)(F-0,31)0,0,C66224,0 ;Autostart Engines

34=CP(+0,6)(+0,7)(F+0,31)0,0,K112,11 ;Engine shut down (CTRL+SHFT+F1)

35=CU(+0,6)(+0,7)0,0,c1005,31 ;Toggle Engine Flag

This one for the CS YAK-3 rear view mirror:

20=CP(+0,6)(+0,7)(F-0,30)0,0,C66294,0 ;(incr.visor) Rear-view mirror

21=CP(+0,6)(+0,7)(F+0,30)0,0,C66295,0 ;(decr. visor) "

22=CU(F+0,6)(+0,7)0,0,C1005,30 ;toggle mirror flag

hm

Link to comment
Share on other sites

if an aircraft.cfg

contains 3 different paints and I want to fly them all three, do I have to specify a section for each paint ?

Yes, because all FSUIPC knows is the aircraft name, the one given in the CFG file. How is it supposed to know it is just a re-paint?

My advice is to set it up for one plane then, outside of FS, edit the FSUIPC.INI file and make the copies of the [buttons.] and [Keys.] sections for each paint, changing the aircraft name appropriately.

Thanks for the tip! Very neat!

Regards,

Pete

Link to comment
Share on other sites

Pete,

I am not the programmer of FSUIPC, but somewhere you have to select the programmed button section in relation to the airplane name. I would program it as follows:

name = the name of the plane known by FSUIPC

section = the name of the section given by the programmer:

if (!strnicmp(name, section, strlen(section)) {

do the programmers section

}

And the section could be valid for one particulary airplane type, disregarding the paint it has, ex.

We could specifie one section:

[buttons.MiG-21UM long range] or even [buttons.MiG-21]

instead of 3 same sections:

[buttons.MiG-21UM long range paint 1]

.

.

[buttons.MiG-21UM long range paint 2]

.

.

[buttons.MiG-21UM long range paint 3]

.

.

We could even even define one section for the different airplane types like the ones that are delivered with the Mig-21 by CS ( a version with one external fuel tank, a clean version and the long range with three external fuel tanks) or one section for all the Maule types (tri-cycle gear, amphibian and three differend kinds of taildraggers) etc.

Just my thoughts...

Regards

hm

Link to comment
Share on other sites

I would program it as follows:

That's all very well, but that has three drawbacks:

1. It assumes that all variations on a specific aircraft will have the same leading characters, and that no others will become included by this assumption.

2. It still means the INI file has to be edited, because, at present, to make the feature user friendly in the Option Dialogues all you have to do is specify that you want these Buttons/Keys to be aircraft specific. FSUIPC creates the section itself using the current aircraft name. I don't want to lose this nice easy facility.

3. The biggest pain is that in order to determine whether there IS a specific section for the current aircraft, FSUIPC would have to ask Windows to read all possible entries (a lot) in the section with the whole name, then if that secured no results, the same name but one character shorter, and so on, only giving up after, what, one character? This could slow things down quite noticeably when loading an aircraft.

The last point arises because, like FS itself, FSUIPC uses the Windows private profile API to handle the INI file. All my programs do, it is too convenient a facility to give up! To get around it efficiently (timewise) I'd have to add another section, [AircraftNames] in which you'd need to catalogue all the names which have sections, like 1=, 2= and so on. Then I search that first and accept the first partial match. If you want a longer match you'd need to put that first in the list (I wouldn't want to have to search the whole list every time).

What is wrong with simply sorting your programming out for one instance and making copies in the INI file for each aircraft you want to apply it to? I think that might be a lot easier to understand and it would certainly save a lot of extra programming for what appears to be no great benefit.

I can certainly do something like what you suggest, as an option. If I take the simplistic (slow) method, it is easy enough. But I don't see much advantage in reality and potentially some disadvantages. I may add it but default it off.

Regards,

Pete

Link to comment
Share on other sites

Okay. I've added the facility to match Aircraft Names to the Buttons or Keys section with the longest match.

It does not operate this way by default. To use this feature you have to set the [General] parameter "ShortAircraftNameOk" to "Yes", by editing the INI file before loading FS. You have to edit the INI file in any case to set the shortened aircraft names.

I'm logging the aircraft names too, now, when they change, to make this easier to sort out, though you can always read the names in the Joysticks tab of FSUIPC (the page with the Flaps control).

The "Aircraft Specific" selection in the Buttons and Keys dialogues will, of course, create a section for a new name using the full name, no abbreviations. You can't go backwards on-line. If the current Buttons or Keys section is being used because of a shortened match, that's the way it stays in the dialogues. Again, to go back to a unique or longer name you would have to edit the INI file to create this.

It is because of the confusion this could cause for beginners that the facility is defaulted off. The performance worries are gone because I found a Windows API which reads all of the Section names into memory, and an in-memory search is fast.

I can send you a pre-release test version to try if you like. Send me an email if so (petedowson@btconnect.com). But I should be making a proper new release (as 3.21) by the end of next week, hopefully.

Regards,

Pete

Link to comment
Share on other sites

Hi Pete,

Thanks,

But my thoughts were going not that far: if someone would like to use "general" sections, well in that case I would say that the order of the sections would play a role. The first section that matches the mask would be the active with the obligation that the first section has to be always the [Keys] or [buttons] general section, and I would halt the scanning at the end of the "activated" section.

On the other hand I see your problem too: what if you add a button or key programming via the FSUIPC interface?

I personally only used the interface to verify which airplane name FSUIPC was using. Because I am using compound button programming most of the "online" programming is refused anyway. But just to satisfy my curiosity: what if you are making a mix of button programming for a mix of airplanes, where you program other buttons for already defined airplanes at different times? Are you creating each time "mini" sections at the end of the config, even if there is already a section defined for the same airplane?

In any case thanks!

hm

Link to comment
Share on other sites

... l in that case I would say that the order of the sections would play a role. The first section that matches the mask would be the active with the obligation that the first section has to be always the [Keys] or [buttons] general section, and I would halt the scanning at the end of the "activated" section.

There's no real "order" in sections in an INI file handled by Windows profile APIs.

I personally only used the interface to verify which airplane name FSUIPC was using.

To help clarify this new option, I am displaying the actual (possibly abbreviated) aircraft name in the Options title bar, when you have "aircraft specific" selected. This could be different for Keys and Buttons, so I have to maintain two current names.

Are you creating each time "mini" sections at the end of the config, even if there is already a section defined for the same airplane?

I don't "create" sections any place, that's done by Windows. If they are NEW sections, yes, it will place them at the end. But if there's already an applicable section for the (possibly shortened) aircraft name, no new section will be created -- that is the active section, the one you are editing.

Regards,

Pete

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.