A Better Set Of Lua Scripts For Rotary Encoders In X-Plane

A few years back I posted a LUA script I had modified for increasing the speed with which a rotary encoder can change something like a heading bug in X-Plane. While you can assign a rotary encoder — either one you place in your sim or maybe one of the dials on a Saitek FIP — to change a heading bug by having it send a keyboard stroke to the simulator, that process moves the bug very very slowly, and this old script speeded that up.

Last week I noticed that the script I used to change my OBS via a rotary encoder was no longer working in FlyWithLua. In trying to find the source of the error I found new posts in this post at the .ORG in which Adamo posted a link to a .ZIP file which has improved scripts for a variety of different bugs you might want to sent via an encoder: Heading, Airspeed, Altitude, VClimb/Descent, OBS, etc. They work GREAT, and are worth downloading if you want this functionality in your sim. The link to the .ZIP file is about half-way down the thread.

How To Flip Both X-Plane Cessna 172 Avionics Switches With Single A Physical Switch

A question that comes up here from time to time is how to have a single physical avionics switch, like that in the great Desktop Aviator switch panel, flip both avionics switches in the X-Plane Cessna 172 (which has two, one on each electronics bus). The answer is to assign the “cross-tie” command to the physical switch, not the avionics toggle command. Hope that helps.

Current X-Plane 11 VR3 Setup & Settings

I noted in my prior post that my VR was running extremely well as a result of some setting changes I’d made based on a YouTube video I’d found. I promised to post a link to that video, and it’s at the bottom of this post. It’s worth watching the entire thing, although the last 10 minutes or so you can probably scan through as it, for the most part, just makes and extended case for the use of the 3jFPS plugin. Here’s the list:

  • I used the automatic overclock wizard in my BIOS to overclock my CPU. A 4.0 chip, it’s running at 4.6. I had already done this two years ago, so this isn’t a new change. DON’T OVERCLOCK YOUR CPU UNLESS YOU ARE COMFORTABLE WITH WHAT YOU ARE DOING AS YOU CAN PERMANENTLY DAMAGE YOUR PC.
  • Based on the video, in my BIOS I also:
    • Disabled power management
    • Disabled CPU C states
    • Disabled Intel Speed Step
    • DON’T MESS WITH YOUR BIOS UNLESS YOU ARE COMFORTABLE WITH WHAT YOU ARE DOING AS YOU CAN PERMANENTLY DAMAGE YOUR PC.
  • Using the NVIDA Inspector I overclocked by GPU by 80 on the clock speed and 200 on the memory speed. DON’T OVERCLOCK YOUR GPU UNLESS YOU ARE COMFORTABLE WITH WHAT YOU ARE DOING AS YOU CAN PERMANENTLY DAMAGE YOUR PC.
  • Using Oculus Tray Tool I:
    • Set the performance to Maximum Performance Plan
    • Disabled USB Select Suspend
    • Set SuperSampling to 0
    • Left ASW alone — which is DIFFERENT from what he says to do in the video, because …
  • … I prefer Oculus Debug Tool for setting the frame rate, as I can decide between fixing it at 45 FPS with AWS or without. I prefer without. This means I need to start the Debug Tool each time I load X-Plane, but I’m good with that.
  • With SteamVR open I used the Advanced Open VR Settings plugin to:
    • Set SuperSampling to 1.6 (and I’ll probably up it to 1.8)
    • Set Compositor to 1.0
    • Set Enable ASF on
    • Leave the next three options off
  • Using Project Lasso, I:
    • Enabled Performance Mode in the overall settings
    • With X-Plane and X-Plane VR running, in Lasso I:
      • Set XP’s priority to High
      • Set its CPU affinity to use virtual cores 2-7 (all but the first two)
      • Set the VRcompositor CPU affinity to virtual cores 0 and 1 (only the first two)
      • Note: If you are not using hyper threading, run XP on all but your first core, and run VRcompositor only on the first core. If you are hyper threading and have more than four physical cores, same principle applies (VRC on the first two, XP on all the rest).
  • In Windows Power Management (which is in the Windows Control Panel settings), I set the power management profiles to Bitsum Highest Performance (which is a profile created by Lasso). If you don’t have Lasso, pick Highest Performance.
  • In NVIDIA Control Panel, I:
    • Set the overall 3D profile Energy setting to Max Performance
    • Turned off Threaded Optimization in the XP profile
  • I downloaded the Water Fix & Default Fog Control plugin and changed the value in the fog plugin to 0.3
  • With X-Plane running, in the 3jFPS plugin Advanced Settings I:
    • Ran the wizard for a min FSP of 45 and max FPS to 46, and took the best FPS options in every other choice it gave me
    • Then I went back through the advanced settings and:
      • Reduced sliders in the LOD settings to the bottom of the green scale
      • Reduced min and max sliders in the visibility settings to the bottom of the green scale
  • In X-Plane graphics settings I:
    • Set it to windowed mode as it seems to perform better minimized
    • Graphics to HDR (position 4)
    • Textures to max (position 4)
    • AA to FXAA (position 2)
    • Objects to almost max (position 4) — while he runs at max objects, I found it hurt my frames too much in busy areas
    • Shadows off, reflections off
  • Finally, I did anything else I could do to reduce the CPU load while playing X-Plane:
    • Turned off Windows auto updates
    • Turned off NVIDIA Geforce Experience
    • Went into the SteamVR settings (using the headset) and turned off anything that would hit the network (friend alerts, etc.), turned off the overlay, etc. — basically just looked for anything that looked ancillary and deactivated it
    • Set Oculus Server to run in administrator mode, which seems to keep it from loading the full Oculus window unless I specifically open it

These setting are working extremely well for me, with solid 45FPS, very smooth performance, and few to no “grey flashes” or frozen views. I do think the changes to the power management settings throughout made a difference, for what that’s worth. It’s really a remarkably good experience, although your mileage may vary.

 

How To Get Rid Of The Annoying Blue Circle In X-Plane VR

I could not stand the blue circle that SteamVR would put around you in the X-Plane VR cockpit. Thanks to Dan on YouTube I found this post by DazzyB on how to remove it. 30 seconds and it was banished forever. Here’s the method:

1) Quit SteamVR if it is already running (you don’t need to quit Steam itself).

2) Launch Explorer and then locate your main Steam folder.  Normally this will be located in C:\Program Files (x86) unless you installed Steam with the custom option.

3) Go into the ‘config’ folder and then open up the file called ‘steamvr.vrsettings’ in Notepad.

4) Copy and paste the following lines of code directly below the line that starts with the { character (located at the very top of the file)…

"collisionBounds" : {
       "CollisionBoundsColorGammaA" : 0,
       "CollisionBoundsColorGammaR" : 255
    },

5) Save and close the file.

 

The GTN 750 Is Finally Working On The Touchscreen

The RealityXP GTN750 is a great X-Plane add in. I loved the Flight1 750 in P3D and was disappointed when I learned that the RXP version would not “pop out” to run on an external touch screen in X-Plane. This was because of a limitation in the X-Plane SDK, and with XP 11.11 it is now fixed. So the 750 returns to the basement sim. I include a brief how-to on removing the 750’s bezel as well. Now if it only showed PilotEdge traffic …

W.E.D. Scenery Development Ride-Along #2

I took some time to record another airport design in W.E.D, this time Cal Black Memorial in Utah. The audio works well in this one all the way through, and I talk through how to add AI traffic and taxiways as well. Thanks for watching, and get out there and design some scenery!

How To Disable NVIDIA Share

Just a few minutes back I was recording a flight on the PilotEdge servers that they will be able to use as a drone in the Western US Expansion area. Just as I was entering the downwind leg of the designation airport my sim crashed – which is only the second system crash I’ve had in X-Plane – making the flight a bust.

This frustrated me.

The culprit was “NVIDIA Share,” which seems to have crashed first, thence crashing the sim. I have since researched how to disable it, and here’s how you do so. Who knows – it may free up some processing headroom as well.

How To Get Started With X-Plane 11 (For Those Coming From P3D Or FSX)

How To Get Started With X-Plane 11 (For Those Coming From P3D Or FSX)

Note: I’ll be updating this as I make changes to my system and as the X-Plane ecosystem evolves. Updated 20 Nov. 2018.

***

As a former P3D user I am often asked “What advice do you have for others making the switch?” So I’m writing this little how-to in hopes it will help other P3D and FSX users at least get the most out of X-Plane, if not make the switch completely. So here goes. This list of steps is a version of my own experience with the switch. There are likely dozens of other possible ways to get started, but based on my experience in P3D and X-Plane, this is what I would do if I were to do it again:

  1. Download X-Plane, either the full package or the free beta. 11.2 is the most recent stable release, although many users (including myself) are using the 11.3 beta. While X-Plane betas are often quite stable, unless you like finding out that things may not work the way they should, stick with the current stable release. Note that X-Plane 11 is taxing on the system, at least as much as P3D, although I find it much smoother at low frame rates. But realize it’s cutting edge, and you may need to back off sliders a bit.
  2. Download and install alpilot’s HD or UHD Mesh Scenery V4. This is sort of the equivalent of ORBX Vector. It will increase the resolution of your terrain and will make roads, forest boundaries, towns, power lines, etc. all much more accurate in the sim. It is excellent, you can download only the areas you want, and it is donationware. (While alpilot does not have the entire world, the X-Plane 11 underlying mesh is also very good as it is, and while not as detailed, is more current.) UHD is more detailed but harder on the system, HD less so. Both are great.
  3. Download and install the Simeaven W2XP models and W2XP sceneries for the parts of the world in which you want to fly (note that Europe is in the X-Plane 11 section of their site, and the rest of the world in X-Plane 10 — although they work in X-Plane 11 just fine). W2XP is shorthand for “World To X-Plane,” and if HD Mesh Scenery V3 is ORBX Vector then the W2XP sceneries are the equivalent or ORBX regional landclasses, with improved textures, autogen, etc. You will download at least two files: the W2XP World Models, and any regional sceneries you want. I downloaded the models, America, and Europe. Don’t worry about the “Net” and “Aerials” versions – you only likely need the main scenery files and the models file. These files, too, are donationware. (UPDATE: If you’re going to use World2XP America, be sure you have these four libraries installed – OpenSceneryX, World Models, R2 Library, and FF Library.)
  4. Download MisterX’s Airport Environment HD textures. These are replacement textures for much of the default runways, tarmac, taxi lines, etc. in X-Plane. It’s a bit like REX Direct. But it’s free.
  5. Download MisterX’s HD Forests package. These are replacements for the default X-Plane trees, and they are more varied and look better. They are also free.
  6. Get some weather. There are several options:
    • Use the default X-Plane clouds and weather, and XP will download real-world weather data if you enable it to do so. While X-Plane’s default weather system used to leave very much to be desired, candidly I now find it quite good and this what I use. That said, if you wish to consider options …
    • Consider SkyMaxx Pro v4, which is payware and $40 US. It’s sort of an Active Sky for X-Plane, although many have found the clouds unrealistic. It also needs an injector, so you could use the NOAA plugin with it if you wanted very accurate weather data.
    • Consider xEnviro, which is payware at $70 and the new guy on the block for sky textures, clouds, and weather injection. I used this for long time and was very happy with it, but the most recent version does not yet work in VR so I am using default weather. I thought it was a very good package. Downsides are that it does not let you set your own weather, so if you want to set a particular situation you are left with X-Plane default clouds (although it does have a “make it clear” setting if you need things to be clear for a while.) But it is under ongoing development, and it improves with each release. I though it was every bit as good as Active Sky Next if not quite AS16/ASCA.
    • Consider Ultra Weather XP. A lot of users consider this the best package going for X-Plane at the moment, although I’ve not used it. It looks great, though.
    • Consider adding different cloud textures and sky textures from the many free alternatives available at X-Plane.org. Just use the search function there and you’ll find lots of free options. Adding them is as easy as dragging the new files into the appropriate X-Plane folder (but backup your originals first by renaming them).
  7. Get some scenery. One place where P3D and FSX users will be surprised is the relative lack of localized scenery in X-Plane (and this is part of the 10% I noted above), although the X-Plane scenery ecosystem is growing so quickly I no longer find myself wanting for scenery. While X-Plane has about every airport in the world, some are just 2D with no buildings, and many cities also lack much of the custom building models that come with FSX and P3D (although Laminar is now including pretty awesome scenery for Las Vegas, Chicago, London, Sydney, and Dubai and others are on the roadmap). The good news is that there is a MASSIVE online community that has designed scenery with which to fill the world, and most of it is free. Here’s my advice:
    • Download the free Prefab airports package. It will fill up 25,000 (yes, 25,000) airports with basic terminals, aircraft, etc. from one of over 30 layouts and make the world far less barren.
    • Do a Google search for any airport you might want appended with “X-Plane” (for example, “KMQS X-Plane“), and it will pull up options for you. You can also search the scenery library at X-Plane.org. Pay particular attention to anything by MisterX, as his airports are excellent (like KSAN … again, free).
    • For even more quality stuff, get some payware.
    • ORBX is now developing for X-Plane, and their stuff is predictably great. While their airport library is just getting started, they have released True Earth for Great Britain South, and it is simply spectacular with more regions to come.
    • Make your own airports! The free WorldEditor (WED to X-Plane folks) program is easy to learn and it’s fun to make your own airport scenery. There are plenty of how-tos on the Web to get you started.
    • Try some orthographic scenery. If you want to fly in the US, the ongoing US Orthophotos Scenery Project is a great place to start. The download process can take a while, but the result is high quality, color-corrected, photorealistic scenery with very high resolution terrain mesh underneath. This is a labor of love for a member of the X-Plane community, and it’s free (although please consider making a donation should you use it.
    • Make your own orthographic scenery. This may be one of the best things about X-Plane. With Ortho4XP you can make your own orthographic scenery for X-Plane, for any area in the world, for free. There are many “how to” videos online for how to do this at YouTube, and honestly, the first time you make it and use it you are left shaking your head, in part because (unlike FSX and P3D), X-Plane places autogen objects, roads, etc. on top of orthographic scenery. The visual result is stunning and you never have to fly over default scenery textures again. Highly recommended.
  8. Read this primer on scenery ordering so things layer in the correct sequence in your sim after you’ve added your new goodies.
  9. Get some airplanes. The big makers (like Carenado) make airplanes for X-Plane, and they look and work great. The good news is that X-Plane 11 ships with several great default aircraft, including jets, gliders, a C-172 (which is excellent) and two twins. The community has also made hundreds of others which you can find at X-Plane.org, and about everyone I’ve asked says the Airfoil Labs C172 SP is the most accurate GA airplane available for flight sim, anywhere, on any platform (including A2A’s 172). Another option for study-level GA aircraft are the SimCoder’s Reality Expansion Packs, which I’ve found worth every penny, and the Zibo 737, which is free.
  10. AI aircraft. Part of my 10%. Default AI aircraft in X-Plane is limited and not nearly as good as in FSX or P3d. But World Traffic does a great job, and will fill your skies with GA and commercial air traffic (including traffic based on real-world schedules).
  11. ATC. Traditionally X-Plane ATC has been not nearly as good as in FSX and X-Plane, but in the 11.3 beta it is quite promising and will only get better. When I want ATC I fly on PilotEdge, which is wonderful as it is real-world quality. And with the new Western Expansion, it’s better than ever. If I want ATC that is not default and not PilotEdge, I have used Pilot2ATC, which I think has great potential and many users say is excellent after you have done the voice training (it reads your voice when you use the push-to-talk switch). And if you download some other voices for Microsoft Windows (available from voice software makers), there’s variety in the voices as well.
  12. Spend time at X-Plane.org. It’s a great resource, and the X-Plane community is extremely welcoming, friendly, and charitable. It’s a great group and a great way to learn.

So that’s the long version. The short version is:

  1. Download the latest stable version of X-Plane (or beta if you wish).
  2. Download HD or UHD Mesh V4 for the parts of the world you want.
  3. Download Simheaven W2XP models and sceneries for the regions of the world you want.
  4. Download Airport Environment HD.
  5. Download MisterX’s HD Forests package.
  6. Read the primer on scenery ordering.
  7. Try the default weather, and if you don’t like it, consider other options per above (but I think you will be pleased with default).
  8. Get the Prefab airports package and MisterX airports (and any other airports you might want).
  9. Stick with the default airplanes for now.
  10. Have fun, and quickly forget what it was like to play with .CFG files.
  11. Bonus step: Download some ortho scenery from the US Orthophotos Scenery Project, and then REALLY be impressed.

A final few words on scenery. First, I know that coming from P3D and FSX some of this seems like a foreign language. This primer on scenery at AVSIM is very informative and will help you learn how things work in X-Plane.

So I hope this helps. I’ve loved X-Plane, and the one time I loaded P3D since I downloaded XP-11 I was left thinking, “Boy, I don’t miss this.” I don’t know if X-Plane 11 is for ever P3D and FSX user (in fact, I’m certain it’s not), but it is for me. It’s fast, stable, looks great, has very realistic flight modeling, and is supported by a massive community of people working together to improve it. I’m sold, and if you decide to try it out, I hope you enjoy it, too.

Solved! How To Use Dual Controls In X-Plane 11

* NOTE: I updated this post on 1/16/17 to clarify how you find the initial assignments of axes and buttons.

The one lingering barrier to my complete switch to X-Plane was the inability to use both sets of the Basement Sim’s controls. It seems that in X-Plane if roll/pitch/yaw are assigned to more than one controller, only one will work and X-Plane disregards the other. (This is not the case with FSX or P3D, which simply read whichever control provides the most recent or largest input.) Only one set of working controls is a real problem for me, as being able to fly with family, friends, etc. is a big part of what I enjoy about the Basement Sim.

There is an answer, though, and it turns out it is Lua. From the Lua website:

Lua is a powerful and fast programming language that is easy to learn and use and to embed into your application. Lua is designed to be a lightweight embeddable scripting language and is used for all sorts of applications from games to web applications and image processing.

 

Lots of simmers and cockpit builders use Lua to write little bits of computer code, called “scripts,” that allow them to execute unique commands (like having the buttons they installed in their panel turn on the cabin lights). Lua scripts are like little apps you can run to get things done that the sim software won’t do itself.

X-Plane is very easy to integrate with Lua thanks to the FlyWithLua plugin. I had posted on the X-Plane.org forums that I was hoping the final release version of X-Plane 11 would allow multiple sets of controls, and one of the very helpful folks in that community — Teddii — responded that a Lua script might be the answer. He said I should be able to write a script for one of the buttons on my yoke where if I flip the button to the left the left controls are live, and if I flip it to the right the right controls are live. He even volunteered possible code.

Getting the code to work meant finding out which axis numbers X-Plane was associating with each of the yokes. Fortunately every time you launch X-Plane FlyWithLua puts a little .TXT file called “initial_assignments.txt” in its plugin folder that shows initial joystick and button assignments. To find my axes and button assignment numbers I first went into X-Plane’s joystick configuration screen and assigned the axes of BOTH yokes to pitch and yaw. This gives you a warning that you have dual assignments in X-Plane, but that’s OK. I also assigned the button that I wanted to use to pass control of the airplane to a command I would recognize (in my case, calling ATC). Looking at the initial_assignments.txt file I could see the pitch, roll, and yaw axes for both yokes and the button numbers for the left / right switch on my Yoko yoke (which X-Plane reads as two buttons – one for each position – rather than as one, and I had assigned BOTH to call ATC in the joystick configuration screen). You will see commands like this in the initial_assignments.txt file:

set_axis_assignment( 0, "roll", "normal" )
set_axis_assignment( 1, "pitch", "normal" )
set_axis_assignment( 3, "yaw", "normal" )

… and …

set_button_assignment( (4*40) + 1, "sim/operation/contact_atc" )

You need to do a little math for the button assignment: (4*40)+1, for example, is 161. That’s the button number for the MyAirplaneYourAirplane code. You may also need to guess which set of axis assignments are the left and right controls, but that’s easy to change if you get it wrong.

I added these variables to Teddii’s initial code, put the “My Airplane Your Airplane.txt” script file in the FlyWithLua scripts folder, and gave it a go. Partial success: it worked in swapping to the right controls, but would not swap them back to the left. Looking at the joystick configuration window in X-Plane I could see that I again had conflicting yaw / pitch / roll controls, and deduced that while the swap from left to right worked, the script did not clear the assignments for the left yoke, resulting in the same problem I had started with (dual-assigned controls).

So I just modified the script a little bit, adding lines to assign the axes that I’m switching away from to “none.” SUCCESS! It worked, and now I’m able to easily pass control of the airplane to a passenger by flipping the yoke switch to the right, and take it back by flipping it back to the left.

The final code follows, and you are welcome to use it if you like. Thanks again for Teddii for his help as I would not have been able to do this without his initial and very helpful code. Also, there is a nice primer on getting started with FlyWithLua here.


 

My Airplane / Your Airplane FlyWithLua Script

-- axis numbers for left yoke
L_axisPitch = 75
L_axisRoll  = 76
L_axisPedal = 52

-- axis numbers for right yoke
R_axisPitch = 25
R_axisRoll  = 26
R_axisPedal = 2

function yoke_switch()
    if button (486) and not last_button(486)
    then
        -- activate right yoke
        set_axis_assignment(R_axisPitch, "pitch", "normal" ) --"normal" or "reverse"
        set_axis_assignment(R_axisRoll,  "roll", "normal" )
        set_axis_assignment(R_axisPedal, "yaw",  "normal" )
        -- DEactivate left yoke
        set_axis_assignment(L_axisPitch, "none", "normal" ) --"normal" or "reverse"
        set_axis_assignment(L_axisRoll,  "none", "normal" )
        set_axis_assignment(L_axisPedal, "none", "normal" )
    end
    if button (480) and not last_button(480)
    then
        -- activate left yoke
        set_axis_assignment(L_axisPitch, "pitch", "normal" ) --"normal" or "reverse"
       set_axis_assignment(L_axisRoll,  "roll", "normal" )
       set_axis_assignment(L_axisPedal, "yaw",  "normal" )
       -- DEactivate right yoke
       set_axis_assignment(R_axisPitch, "none", "normal" ) --"normal" or "reverse"
       set_axis_assignment(R_axisRoll,  "none", "normal" )
       set_axis_assignment(R_axisPedal, "none", "normal" )
    end
end

-- check for the switch button every frame ...
do_every_frame("yoke_switch()")

-- end