questions about l:vars for unique ad-on

Post any technical issues here. This forum gets priority from our staff.
jfayre
Airman
Posts: 19
Joined: 04 Dec 2019

questions about l:vars for unique ad-on

Post jfayre »

Hi all,
I am totally blind, and use a variety of aircraft add-ons to allow me to fly various aircraft in Prepar3d. I've been playing around with the c182 to se what I can make work.
Using my screen reader, it is possible to click on various buttons using the mouse, mostly due to the awesome tooltips that are provided for each button.
I'm writing an add-on to hopefully increase the accessibility of this awesome aircraft. I have looked at the l:var list provided by a2a, and it looks like it is incomplete. For example, the l:var for the starter switch, l:Eng1_starter. isn't listed.
I've pulled a list of all the l:vars using FSUIPC. Is it possible to get an updated list of which variables are writeable?
For example, I would like to be able to write to the variable for the maintinace panel to perform actions like a full overhaul. There is a variable called L:CompleteOverHaulButton (or something similar), but writing to it doesn't appear to do anything.
My goal is to provide hotkeys for commonly used functions, since manipulating the mouse as a blind person isn't at all easy.
Any help would be apreciated.

User avatar
Nick - A2A
A2A Captain
Posts: 11100
Joined: 06 Jun 2014
Location: UK

Re: questions about l:vars for unique ad-on

Post Nick - A2A »

Hi jfayre and welcome to the A2A forums,

Your add-on project sounds like an interesting one. When it comes to the custom L:Vars used in the Skylane and other A2A aircraft, bear in mind that some of them aren't designed to be directly accessed by the end user, but are controlled by Accu-Sim code instead, and not all L:Vars that you can list from the Accu-Sim module using FSUIPC are active in all aircraft.

To take your example of the engine starter, in the 182 this is controlled by the "L:Magnetos1" variable as the engine starter in the real aircraft is operated using the magneto switch rather than a separate starter button. There's a bit more info on this in the L:Var list which you have mentioned.

(L:Magnetos1,enum) - starter key (0 – Off; 1 – Right; 2 – Left; 3 – Both; 4 – Start)

When it comes to assigning click spots within the 2-D panels via L:Vars/Lua, I'm not sure how fully this is supported, but I'll check with the guys to see if L:Vars like "L:CompleteOverHaulButton" can be accessed using software like FSUIPC or not.

Thanks,
Nick
A2A Simulations Inc.

jfayre
Airman
Posts: 19
Joined: 04 Dec 2019

Re: questions about l:vars for unique ad-on

Post jfayre »

Hi Nick,
That's interesting. When I write the value 1 to L:Eng1_starter, the starter does fire on the c182.
The add-on that I'm writing already reads out altitude and various other instrumentation for standard FSX aircraft, I'm just trying to add additional functionality to the a2a aircraft. Actually, depending on complexity, the support for the A2A aircraft may end up being an additional add-on. It's all open source and on Github. The group of blind flight sim pilots is a small one, and we're always trying to come up with creative ways of doing things.
Thanks much!

User avatar
Nick - A2A
A2A Captain
Posts: 11100
Joined: 06 Jun 2014
Location: UK

Re: questions about l:vars for unique ad-on

Post Nick - A2A »

Yeah, writing to the starter L:Var directly may well work in the 182, but for hardware cockpits and so on, it's intended to be triggered via the magneto switch which is why this is the variable that's published in the PDF list.

We'll certainly do what we can to help with development of your add-on. However, things will indeed be a bit more complex than for default aircraft due to the custom code which is used for many areas of the simulation. For example, many of the instruments use custom variables as you've no doubt already realised. However, using the appropriate L:Vars, pretty much anything should be possible in theory and some of the talented simpit builders on the site have shown.

Kind regards,
Nick
A2A Simulations Inc.

jfayre
Airman
Posts: 19
Joined: 04 Dec 2019

Re: questions about l:vars for unique ad-on

Post jfayre »

Hi,
The add-on I spoke about a while back has come a long way.
All the info can be found at:
http://www.github.com/jfayre/talking-flight-monitor
I'm now ready to dig into the a2a aircraft stuff specifically. Is there any way we can get write access to the specific l:vars for things like the maintenance hanger?
I can read all manner of things in order to give the user speech feedback for instruments. I can also write back anything that uses standard sim controls through fsuipc offsets. I just want to make it easier to set specific a2a things.
Any help would be greatly apreciated.

This would be extremely helpful!
There are a few of us that are using the a2a aircraft already, but the things we need to do to use them are complex to say the least.

User avatar
Scott - A2A
A2A General
Posts: 15738
Joined: 11 Feb 2004
Location: USA
Contact:

Re: questions about l:vars for unique ad-on

Post Scott - A2A »

Jim,

Can you give a basic run down of what you are trying to accomplish in the maintenance hangar, specifically? Providing just a list of lvars doesn't really do the trick as they all do different things and their names may not indicate what they actually do, since we code this for us to make a product and not thinking of someone out there making sense of it from the outside.

So just give me a big picture of what you are trying to accomplish, then some specifics.

Scott.
A2A Simulations Inc.

jfayre
Airman
Posts: 19
Joined: 04 Dec 2019

Re: questions about l:vars for unique ad-on

Post jfayre »

Hi Scott,
Well, I think I can already read various parameters so people can tell what needs to be fixed on the aircraft.
However, what we can't do easily is actually press the buttons on the hanger panel. The complete overhaul button, etc. I believe there are l:vars that indicate when the button has been pressed, but you can't actually press it using a write to an l:var.
I haven't done an exaustive dive into the various l:vars, so I'm still not totally sure what's possible.
The way that we are finding the button now is to bring up the hanger panel, then move the mouse around until the screen reader reads the tool tip on the button we want. That, or do an OCR on the window to try and find the button that way. Both ways work, sometimes, but is extremely cumbersome.
Does that help? I might be able to track down a video of a blind user using the a2a c182.

jfayre
Airman
Posts: 19
Joined: 04 Dec 2019

Re: questions about l:vars for unique ad-on

Post jfayre »

Hi,
Just wanted to revisit this topic. Would it be possible to get write access to the specific l:vars for fuel loading and the maintenance hanger? My add-on now has basic support for the A2A Bonanza, but access to these variables would make it much easier for us to use this awesome aircraft.
The latest info on the add-on can be found at:
http://www.github.com/jfayre/talking-flight-monitor
Thanks!

User avatar
ROB - A2A
A2A Colonel
Posts: 3566
Joined: 02 Mar 2004
Location: Bytom, Poland

Re: questions about l:vars for unique ad-on

Post ROB - A2A »

Hi.

You can add / remove fuel using the fuel quantity variables:

FuelLeftWingTank for the left wing tank.
FuelRightWingTank for the right wing tank.

These are gallons, so add gallon by gallon or just set quantity at once. Remember not to go below zero or above max capacity which is defined by FuelLeftWingTankCapacity and FuelRightWingTankCapacity variables (which is 40 gallons).

To control the fuel tip tanks, mount them up first using TipTank variable. Set it to 1. Then use following variables to fill them up:

FuelLeftTipTank for the left tip.
FuelRightTipTank for the right tip.

Their capacities are defined by FuelLeftTipTankCapacity and FuelRightTipTankCapacity variables (20 gallons) if the tip tanks are mounted up.
Setting the TipTank variable to 0 clears all these values to 0.

BTW you can open any of our 2D panel files in a dedicated editor that comes with the Prepar3D SDK and read the variables out and even a code which runs behind each click. The editor is named ace.exe.

regards
ROB
A2A Simulations Inc.

jfayre
Airman
Posts: 19
Joined: 04 Dec 2019

Re: questions about l:vars for unique ad-on

Post jfayre »

Amazing!
I'll need to take a look at that editor and see how accessible it is.
How about oil quantity and accessing the maintenance hanger?
Is there a list somewhere of all the various variables that are writable? I saw a pdf, but that definitely didn't have all this.

User avatar
ROB - A2A
A2A Colonel
Posts: 3566
Joined: 02 Mar 2004
Location: Bytom, Poland

Re: questions about l:vars for unique ad-on

Post ROB - A2A »

The purpose of the PDF, you mentioned, is to help a builder to create a real life replica of a cockpit so it is oriented for various cockpit controls, switches, knobs and levers. So far we don't provide a list of variables for the 2D Panels because these are the text - actually XML - files.

The oil quantity, together with most of the maintenance hangar items, are more complicated as it is not enough to change a value of a variable. There is an accompanying code which should be executed each click. You can find this code using the editor, I mentioned.

This is an example of a code of adding 0.25 gallons of the oil:

(L:Eng1_OilQuantity,gallons) 0.25 + (L:OilCapacity,gallons) min (>L:Eng1_OilQuantity,gallons) 1 (>L:FluidClick,bool)
46 (>L:SystemCondSelectFSX,number) (L:Eng1_OilQuantity,gallons) (>L:SystemCondValueFSX,number)

Here we remove 0.25 gallons:

(L:Eng1_OilQuantity,gallons) 0.25 - 0 max (>L:Eng1_OilQuantity,gallons) 1 (>L:FluidClick,bool)
46 (>L:SystemCondSelectFSX,number) (L:Eng1_OilQuantity,gallons) (>L:SystemCondValueFSX,number)

By changing the variables alone, without the accompanying code, you will corrupt the state of the simulation.

regards
ROB
A2A Simulations Inc.

jfayre
Airman
Posts: 19
Joined: 04 Dec 2019

Re: questions about l:vars for unique ad-on

Post jfayre »

Ok, I think I understand.
Is there any way you can think of to trigger these variables and the underlying code without a mouse click?
Could I add something to the xml to trigger something when a custom variable is set for example?
I understand I'm going above and beyond what is typical, so I really appreciate your help.

User avatar
ROB - A2A
A2A Colonel
Posts: 3566
Joined: 02 Mar 2004
Location: Bytom, Poland

Re: questions about l:vars for unique ad-on

Post ROB - A2A »

I think you can simulate a click by executing its code once.
You would have to create your own trigger variable as a bool or enum, set it to 1 to trigger it, then some code that tests if the trigger is 1, then executes the exact copy of our click code, then disable the trigger by setting it to 0 after the execution. I'm not quite sure what you are able to do (I haven't tested your talking flight monitor project so far, which is pretty impressive judging its feature list), you would need to run the test code all the time. Ideally something event based would be better, a key stroke?

regards
ROB
A2A Simulations Inc.

jfayre
Airman
Posts: 19
Joined: 04 Dec 2019

Re: questions about l:vars for unique ad-on

Post jfayre »

I'm sure your solution would work. The trouble is that I would rather not modify your XML code. This would make installing my software a bit of a nightmare, especially when A2A updates things.
Right now, my software works by reading and writing offsets from FSUIPC for standard aircraft. For the a2a aircraft, I'm using fsuipc in combination with a lua script to read and tweak variables when keys are pressed.
Could I replicate your code for things like adding oil via this method? I mean reading/writing to the proper variables in the correct sequence?
I'll admit that I haven't delved into the workings of XML gauges before. I just haven't needed to so far, so not very familiar with the syntax.
Thanks so much for your help on this!

User avatar
ROB - A2A
A2A Colonel
Posts: 3566
Joined: 02 Mar 2004
Location: Bytom, Poland

Re: questions about l:vars for unique ad-on

Post ROB - A2A »

Yes, I think reading and writing to the proper variables in the correct sequence on an event like a key press should work.
To properly read out the XML code you should get familiarized with Reverse Polish Notation. To put it simple in this notation adding two values like A + B looks like A B +.
So adding a gallon of oil would look like this (in pseudo code):

Eng1_OilQuantity 1 + = Eng1_OilQuantity

You put the oil tank variable on the stack a the first operand, then 1 as the second operand, then the operator + to add them both and finally you write the result to the oil tank variable.

Here's the link to the appropriate part of the P3D SDK with all the operators and usage examples, if you are interested.

Now, I can see two general problems: finding actual click code, which is buried somewhere within an XML file and reading its syntax to translate to a LUA Script or whatever. I can help you with finding or reading, or both. This should speed up your project. Unless you like challenges... but I guess there are some folks that wait for your project to have some fun flying.

regards
ROB
A2A Simulations Inc.

new reply

Return to “C182 Skylane Tech Support”

Who is online

Users browsing this forum: No registered users and 6 guests