Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I am flying the A2A P-40 in P3Dv4.5.

The hydraulic system in this aircraft requires manual recharging after each use (flaps, gear only). This can be done in the aircraft using a mouse to press a switch on the yoke. The problem is that the switch must be kept pressed until the hydraulic pump has completed its task. When released at that point, the pump switches off. It is not a toggle action, like a gear toggle. It is more like a trim switch in the way it works.

It is very awkward to do this with a mouse in the P-40. It is a complex, vibrating aircraft with many controls and switches. In bad weather it is all but impossible.

To get round this, I have tried to assign a key press -V- to this in FSUIPC6 but without information on the control I cannot confirm the assignment. On the left side, there is a 'Hydraulic Switch Toggle' option. I have tried assigning this but the switch on the yoke does not respond. In any case, a toggle switch is not what is needed.

I have checked your Controls List for P3Dv4 build 34698 but there is no control listed for a hydraulic pump 'on' with repeats.

I'd be grateful for advice. (log attached).

FSUIPC6.log

Posted
9 hours ago, John Fee said:

I have checked your Controls List for P3Dv4 build 34698 but there is no control listed for a hydraulic pump 'on' with repeats.

The controls list is generated from information supplied by P3D itself. It is not concocted by FSUIPC. If there is no suitable control listed there are two possibilities: either A2A has not provided any control to operate that switch (more like a button by the sound of it), or they have done it by re-using an otherwise unused or "custom" control.

If the former case is true then there are two conceivable ways of programming it: using a mouse macro, or seeing if there's an L:Var which does the job. Mouse macros are described in the FSUIPC user manual. To find LVars you can use the supplied Lua plug-in to log Lvars.  Run that plug-in my assigning it to a keypress, then operate the button and see if an LVar value changes.

The log you supplied shows nothing apart from the start of the session, so it isn't clear why you supplied it.  To find out whether a control is being used after all, enable Event logging (FSUIPC Logging tab), then operate the button. If a control is being used it will be logged.

Pete

 

Posted

Thanks, Pete.

I will have look into your suggestions. I agree a button would be preferable but I have very few buttons at my disposal and they are needed for other things.

I sent the log so you'd know I was using the latest iteration of FSUIPC6 for P3Dv4.5.

Posted

John,

This has been tested in FSX using the "C" model P-40, A2A Wings of Power III.

Constructing a L:Var macro with the variable name - L:HydraulicPumpControl will control the control stick button. Assigning the macro on button press with a parameter of 1 will be a button push, 0 will be a button release. Ex.
#=L:HydraulicPumpControl=Set 

You could get a slightly different action by assigning the macro with the action - TOGGLE  (press once for ON, press again for OFF)
~pg 43 FSUIPC4 for Advanced Users.pdf

Roman
 

  • Like 2
Posted

Thanks very much for this. I would be in business if I knew anything about LUA.

I've perused the LUA documents and the Advanced Users pdf.  I will study them more carefully over the next day or two - there's a lot in there which is probably not relevant to my problem. But maybe I need a full understanding? Do I need to learn the language? I just don't know.

The bit that escapes me so far is where to enter the relevant information? Is there a LUA.ini file somewhere which can be edited?  I couldn't find it.

I have the Lua_Plugins_20190320 folder with the examples folder.

Where on earth to begin?

 

Posted

John,

We are controlling only 1 L:Var here, therefore using Lua would be overkill.. Yes, Lua could be used, specially if controlling more than 1 L:Var and/or incorporating some kind of logic behind it. In this case there is no logic, it is either pressed or not pressed. In this example we are just using a .mcro file to inject a custom control to be used by FSUIPC. 

1) Flight Sim closed.
2) Unzip the attached "P40_Hyd.zip" and place the "P40_Hyd.mcro" file into the <flight sim>\modules folder
3) Start FS and assign your joystick button as shown in the image below.
Note - to use a keyboard key would be very similar, just use the "Key Presses" tab instead.
4) Done

Good luck,
Roman

P40_HYD.jpg?dl=0

 

P40_Hyd.zip

  • Thanks 1
Posted

Thanks a bunch, Roman. You're a star!

I have it working on a yoke button. Oddly,  I can't get it to work from a key press but that's not important.

Just a comment. P3Dv4.5 doesn't have a \modules folder. I put the "P40_Hyd.mcro" file into the same default folder as the FSUIPC6 files:

  C:\Users\Howard\Documents\Prepar3D v5 Add-ons\FSUIPC6

And a question: May I ask where you found the "P40_Hyd.mcro" file? Just in case i want to try something similar again.

Posted

John,

59 minutes ago, John Fee said:

May I ask where you found the "P40_Hyd.mcro" file? Just in case i want to try something similar again.

Unlike the FSUIPC built in macro maker for C+ type gauges, macros for L:Vars have to be handmade.  (~pg 43 FSUIPC4 for Advanced Users.pdf, "Macros to change Lvars")
The macro facility to operate Lvars can only be used by editing macro files and building them manually. The format is: N=L:name=ACTION
Note, not a big worry as the .mcro files are no more than text files with a .mcro extension. Use Notepad or some other plain text editor to view/edit them.
BTW, I attached a bunch of zipped up .mcro files as examples you can look at. They will serve no other purpose for you.

The difficult part is finding the correct L:Var variable name, once you have that, the .mcro making part is easy.
As Pete mentioned here
"To find LVars you can use the supplied Lua plug-in to log Lvars.  Run that plug-in my assigning it to a keypress, then operate the button and see if an LVar value changes."
There are other ways such as using a hex editor to inspect the interior model (.mdl) file and such but that is way beyond the scope here.

That's about it, hard = finding the L:Var name, easy = making the .mcro file itself.

Strange that the macro doesn't work on the keyboard, it should.. As for the modules folder location, yes, sorry about that, just used to it being "old style", contained within the simulator folder structure.
Glad you got it working! 


Roman

macro examples.zip

  • Thanks 1
Posted

Thanks for putting all this together.

I need to learn about macros first and then apply that knowledge. I am not too sure where the Lvars log file is to be found. I have the 'Log Lua plugins separately' option checked under Logging.

Best,

John

Posted
8 hours ago, John Fee said:

I am not too sure where the Lvars log file is to be found.

They are logged to the FSUIPC6.log file, also located in your FSUIPC6 installation folder.

8 hours ago, John Fee said:

I have the 'Log Lua plugins separately' option checked under Logging.

That won't affect logging of lvars from a control. There is a lua script that also logs lvars that you can use (see the example lua scripts provided), but I think its easier to use the control if not familiar with lua.

John

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.