Pilotedge Helper: a LUA script with some handy features

Post Reply
svilenv
Posts: 49
Joined: Sat Jan 09, 2016 8:31 am
Location: LBSF

Pilotedge Helper: a LUA script with some handy features

Post by svilenv »

Hey guys,

I cooked up a small X-Plane 10 LUA script with some handy functions for online flying on Pilotedge, Vatsim, etc. Requires FlyWithLUA plugin installed.

Features

Mini transponder gauge

An unobtrusive mouse-driven transponder gauge, giving you the ability to always have a "mode C" capable transponder with IDENT functionality on any airplane/model that you use.

The gauge is hidden by default and activated by moving your mouse to the bottom right corner of your monitor: the gauge then appears and you can change your squawk code by mousing over the individual digits and rotating the mouse wheel up or down.

Image

The colored vertical bar on the left represents the mode of the transponder:

* red = transponder off
* yellow = transponder standby
* green = transponder on/alt (mode "C")

Image Image

The modes can be cycled by left-clicking anywhere within the main transponder window: click once to go from OFF to SBY, then one more time to go from SBY to ON/ALT the once more to go from ON to OFF, etc.

NOTE: Please note that neither X-Plane nor the network pilot clients distinguish between the modes ON and ALT. Some airplane models do have transponders that visually represent these different modes, but that's purely cosmetical and uses the same internal X-Palne dataref: as far as X-Plane and the pilot clients are concerned there are three transponder states only (+ a test state which is interpreted as ON by the clients as well) and when the controller tells you to "squawk C" or "squawk altitude" if you're green, you're good

The upper part of the gauge represents the IDENT button: clicking anywhere in that upper area will send the ident signal and this is what you press when a controller asks you to ident. While identing, the upper area will blink very fast in green color, to give you a visual cue that you're identing.

Image

Moving your mouse outside of the gauge area hides the gauge, so you can enjoy an uncluttered screen without breaking your immersion.

NOTE: The gauge is fully compatible with plane models that already have built-in transponders: in these cases it can be treated just as an alternate method of manipulating the transponder values, or can be completely ignored (or disabled: see below)

FPS counter

On the bottom left of your screen you'll see several indicators, the first of which is a FPS counter:

Image

True, you can opt to visualize your FPS by displaying the relevant X-Plane dataref in the upper left corner, but it's a big ugly box that holds a ton of additional information that you probably don't need unless you're troubleshooting something.
This here is a simple color coded FPS counter: with frames at 30 or above it's green, the range 20 to 30 is yellow and at 19 or bellow it goes red.

NOTE: The 19 FPS threshold is an important one when flying online: when you drop below it X-Plane will start transparently decreasing your simulation rate, so that your system is able to cope with the rendering strain. The net result is that you will be moving around more slowly than you think you are (and than your gauges are telling you). For the controllers watching you on their scopes and for other pilots in the air your ground speed would be slower than displayed: e.g. you might be at 120kt indicated / 140 ground speed according to your speedometer, but due to the sim-rate decrease you might be effectively at let's say 100 ground speed and this is how it would appear to the other guys on the network, be it ATC or other pilots. You can ocassionally hear controllers on Pilotedge commenting on this on the frequency and mentioning "the FPS issue"

Selected COM radio (and frequency)

The second indicator shows you the currently selected COM radio for transmitting (along with its currently dialed frequency):

Image

When flying online and having to deal with multiple frequency changes it's convenient to use both COM radios (when your plane has them). Unfortunately many models / addons fall short when it comes to selecting the radio for transmitting: some addons just don't have working buttons for that in their 3D cockpits, some tie it to the listening radio selections, some use custom code, etc. It's inconsistent and I've heard pilots on Pilotedge many times unintentionally transmit on the wrong COM radio (and I've done it myself).
So it's very handy to be able to *determine at a glance* which COM radio is selected for transmission and what frequency is dialed in it. This is what this indicator does and it's also *color coded*: it's white when COM1 is selected, yellow when COM2 is selected and red while you're transmitting (the "Contact ATC" button pressed):

Image Image

Incoming transmissions are also monitored and represented visually: while a transmission is being received, the radio text will be wrapped in ">...<" symbols.

Apart from being an indicator, this area is also an actuator, i.e. it not only shows you the information, but allows you to change it (COM1 <-> COM2): clicking anywhere on the COM area will toggle the transmitting radio from COM1 to COM2 or vice versa. You can use that if your plane/hardware does not have a convenient way of switching between the radios.

Transponder mode indicator

The last indicator displays the current transponder mode, which is also handy to have at a glance at all times: you ought to have your transponder on when airborne at sometimes also on the ground when the airport uses Ground Surveilance Radar. The indicator is color coded and displays a red [-] symbol when transponder is off, yellow [S] when transponder is on standby and green [C] when transponder is ON (mode C):

Image

Electrical system fixes for various aircraft addons

The script includes dynamic fixes to the electrical systems of some addons, in order to correct unrealistic values, dummy switches or other deficiencies and to avoid loss of comms due to unwarranted battery discharge.

The following addons are supported:

SMS DHC-2 Beaver

- Coupled the dummy/custom alternator switch with X-Plane's generator dataref to avoid gradual battery discharge and comms loss during longer flights. Engaging or disengaging the plane's alternator will now correctly pass the event to X-Plane's built-in systems.

Installation

Firstly you need to have the FlyWithLUA plugin: http://forums.x-plane.org/index.php?app ... file=17468 installed. You might already have it if you're using RealTerraHaze or some of the other popular scripts that require it.

To get the PIlotedge Helper Script go to: https://github.com/tarakanbg/pilotedge_helper and press the "Download ZIP" button:

Image

Unpack the ZIP archive, grab the `pilotedge_helper.lua` file and drop it in your X-Plane `\Resources\plugins\FlyWithLua\Scripts` folder. That's it.

Customization

You can optionally edit the first few lines of the script in your preferred text editor to customize it:

Image

The preferences are described in the file and should be self-explanatory: you write `1` or `0` to enable/disable individual components depending on your needs. The joystick button number is needed if you want your COM indicator to turn red while transmitting: unfortunately X-Plane does not provide a dataref for the "Contact ATC" event that could be monitored, hence this workaround with monitoring the button press itself.

Enjoy!
Last edited by svilenv on Wed Mar 23, 2016 11:32 am, edited 1 time in total.
Svilen Vassilev (N217S)
PE I-11 graduate, Certified Armchair Pilot
| Youtube flight recordings | Livestream
Keith Smith
Posts: 9942
Joined: Sat Oct 09, 2010 8:38 pm
Location: Pompton Plains, NJ
Contact:

Re: Pilotedge Helper: a LUA script with some handy features

Post by Keith Smith »

Very good. It sounds like you're looking for a way to determine if the PTT is being engaged. There's no need to intercept the contact ATC event. We have datarefs that reflect the PTT status as well as the COM1/2 TX/RX status. Use the dataref to search for 'pilotedge' and you shall see all of the relevant datarefs.
svilenv
Posts: 49
Joined: Sat Jan 09, 2016 8:31 am
Location: LBSF

Re: Pilotedge Helper: a LUA script with some handy features

Post by svilenv »

Thank you, Keith, very handy advice.

I've modified the script to use pilotedge's own tx dataref instead of the button watcher and removed the now obsolete config option.

Cheers! :)
Svilen Vassilev (N217S)
PE I-11 graduate, Certified Armchair Pilot
| Youtube flight recordings | Livestream
davidspreckeriii
Posts: 62
Joined: Sat Feb 21, 2015 12:24 am

Re: Pilotedge Helper: a LUA script with some handy features

Post by davidspreckeriii »

This is pretty sweet! I like the IDENT button the most as I have some planes, like the DDEN Challenger, that I'm either unable to find how to IDENT or the plane doesn't have a working IDENT button. I know it's caused some issues in the past with ATC when they asked me to IDENT and I couldn't. Ive been sticking to planes that I can IDENT with just to prevent those issues.

Edit: If anyone knows how to IDENT on the Challenger, please let me know via PM!
svilenv
Posts: 49
Joined: Sat Jan 09, 2016 8:31 am
Location: LBSF

Re: Pilotedge Helper: a LUA script with some handy features

Post by svilenv »

Thanks, David, glad you find it useful :)

I pushed a small update adding monitoring and visual indication of received transmissions on the active radio (>...< indicators will now wrap the text while you're receiving a transmission).

Another area of improvement that I thought would be appropriate for this script is including dynamic fixes to the electrical systems of some addons, in order to correct unrealistic values, dummy switches or other deficiencies and to avoid loss of comms on Pilotedge due to unwarranted battery discharge. So far I've only added a fix for the alternator issue of the SMS DHC-2 Beaver: coupled the dummy/custom alternator switch with X-Plane's generator dataref to avoid gradual battery discharge and comms loss during longer flights. Engaging or disengaging the plane's alternator will now correctly pass the event to X-Plane's built-in systems. I'll be adding fixes for other a/c when needed/spotted, i.e. some Carenado/Alabeo planes are all over the place when it comes to electrics, etc. The electrical fixes are optional and can be disabled en-masse or individually in the config options.

I don't want to spam the topic here for every single update to the script, so for people who are using it and want to keep track to the changes: monitor the Changelog here (the link will always point to the latest revision).
Svilen Vassilev (N217S)
PE I-11 graduate, Certified Armchair Pilot
| Youtube flight recordings | Livestream
Keith Smith
Posts: 9942
Joined: Sat Oct 09, 2010 8:38 pm
Location: Pompton Plains, NJ
Contact:

Re: Pilotedge Helper: a LUA script with some handy features

Post by Keith Smith »

Svilen,

You're welcome to post your updates here, it's not an issue. Nice work.
ridikamus
Posts: 139
Joined: Thu Mar 26, 2015 7:37 pm

Re: Pilotedge Helper: a LUA script with some handy features

Post by ridikamus »

Greetings,

I've just installed this nifty script to get around the lack of an IDENT button, but I've encountered a problem.

With the script enabled I cannot move the knob that adjusts frequencies to the right of the decimal point (ex. if the freq is "123.45" I am unable to change "45") on aircraft that use the x-plane GNS 430/530 for COM1/NAV1. I've tried it on the Carenado B1900D and the Dreamfoil EMB-110 on both the 3D panel and the 2D popup.

EDIT: The line I commented out doesn't keep the rest of the script working, it just crashes the whole Lua engine, so I've removed that part of the post.

Hopefully that helps you track down the issue - this is a fantastic script!
V-3 CAT-11 I-11
svilenv
Posts: 49
Joined: Sat Jan 09, 2016 8:31 am
Location: LBSF

Re: Pilotedge Helper: a LUA script with some handy features

Post by svilenv »

Thank you for the report, David!

I found the bug and have pushed an updated version of the script to Github (+ also fixed the inconsistent TX indicator color). Please let me know if this solves the issue for you as well.
A bit embarrassing not having noticed this for so long: I'm using external hardware for the radios hence these in-sim manipulators went unnoticed. Glad you're finding the script useful otherwise.

P. S. Technical post mortem: It was the inclusion of FWL's internal "radio" module that was causing the issue, by declaring a writable variable for the COM radio freq and thereafter holding onto the value and not allowing it to be changed. Removing the dependency on the radio module and using own read-only variables to access those datarefs did the job.
Svilen Vassilev (N217S)
PE I-11 graduate, Certified Armchair Pilot
| Youtube flight recordings | Livestream
ridikamus
Posts: 139
Joined: Thu Mar 26, 2015 7:37 pm

Re: Pilotedge Helper: a LUA script with some handy features

Post by ridikamus »

Works perfectly. Thanks for the quick fix! Now I can stop telling controllers "Unable ident".
V-3 CAT-11 I-11
tbaac
Posts: 38
Joined: Sat May 14, 2016 2:32 pm
Location: EGLF, England

Re: Pilotedge Helper: a LUA script with some handy features

Post by tbaac »

Thanks very much Svilen.
The transponder controls should come in very handy.

You inspired me to have a go at an elevator trim gauge based on your approach.
(I have a Saitek Trim Wheel and find it awkward to know the initial position when there's no trim gauge, in a real plane I imagine its not as hard to find the initial position)
Thanks :)
Post Reply