Fsuipc Lua Plug-Ins
Fsuipc Lua Plug-Ins
(For FSUIPC4 version 4.96 and later, or FSUIPC3 version 3.999z3 and later,
also WideClient 6.999n and later)
This document is part of the Manual for the LUA plug-in facilities first added to FSUIPC4 at
version 4.211, and FSUIPC3 at version 3.841. This part takes the form of a series of questions and
answers. The library reference document, "FSUIPC Lua Library" provides the technical data for
the FSUIPC Lua additions.
What is “Lua”?
It is a programming language. The best way to see and learn what it is all about is to visit this web page:
http://www.lua.org/about.html
What is a “plug-in”?
Plug-in is simply a technical term for a program which can be run inside or as part of another program. Effectively
FSUIPC is a “plug-in” for FS. The Lua facilities in FSUIPC allow multiple plug-ins by loading and running
individual Lua programs.
ipcDebug.lua The auto-loaded program section loaded before any Lua program being debugged.
It enables line tracing to the Lua program’s own Log file.
HidDemo.lua This shows what can be done with the com library facilities to read and process
HID (Human Interface Devices) with particular attention to joystick or analogue
axis values and buttons. If you have a device which exceeds FSUIPC's capacities
for axis types and numbers or buttons, this is the way to solve that problem. You
can handle up to 16 each of 12 difference named axes, and up to 256 buttons, on
each connected device of a joystick type. And because WideClient also supports
the com library, you can do this across a Network too.
rotaries.lua This uses the HID features of the com library to implement fast and slow turning
button results for rotary encoders which otherwise only indicate one button
press/release for each direction.
TripleUse.lua This is an example of using the event.button() function for getting three separate
uses from a single button, by single click, double click and longer press methods.
It could be extended to cover many buttons. It would need running initially by an
ipc.macro() call in ipcReady.lua.
TileSix.lua This is a very simple example of the use of the ext.position function (in the ext
library) to tile six undocked FS windows on a second screen.
log lvars.lua A useful little routine which logs all of the currently available local panel variables
(LVARS) which can be read and written using the Lua ipc library, or written using
FSUIPC Macros via the “L:<name>,action” facilities. The values are listed in the
Log initially and when any change, and also displayed as they change on the
screen, in the Lua display window.
Use this to work out how to define your macros in order to operate many switches
and facilities otherwise inaccessible without using a mouse.
Init pos.lua A small program which simply places the user’s aircraft at a fixed place with a
given airspeed. (The airspeed setting only works correctly with FSX or ESP).
Display vals.lua Continuous on-screen displays of some aircraft variables. Undock the window for
greater clarity.
Record to csv.lua A data recorder, writing lines of important data about the aircraft at up to 20 times
a second, The file is in CSV format, displayed nicely in Excel and similar
programs. [Note that the original version included a syntax error in line 49].
Fuel737.lua
Payload737.lua These two examples demonstrate the ipc.keypressplus function, which can send
keypresses to FS which even work in Menus, and when FS doesn't have the
focus—the function provides options for changing focus there and back. The
examples are merely editing fixed values into the default 737 fuel and payload
menus, respectively, but could be generalised with more sophisticated Lua
programming.
Testsrvr.lua
Testclnt.lua A pair of programs, Server and Client, which can be run together (start the server
first) to test / demonstrate the LuaSockets facilities built into FSUIPC. As defined
they run in the same FS session (host is defined as "localhost"), but you can
change this to run between two PCs running FS if you like, or simply run one of
them directly under the Lua stand-alone interpreter—but in the last case you'd
need to take care of the correct LuaSockets installation.
SlaveServer.lua
MasterClient.lua Another pair of LuaSockets demos. These are more eye-catching when used, but
you do need two PCs running FS. You'll need to edit the Host name in both to be
the name of the Server PC, which will have its user aircraft slaved to the Client,
which acts as Master. It works quite well for a rather crude un-optimised
implementation—not smooth, but not as jerky as I thought it would be. If one PC
is more powerful than the other it works best with the more powerful acting as the
Master Client. The Salve is best put into Slew mode, though it will work in normal
flight mode (jerkier) and may well work okay in Paused mode.
gfdDisplay.lua Test program for all known and connected GoFlight devices, using the gfd library.
VRI_SetMach.lua An example plugin for the VRInsight MCP Combi to allow it to be used with
Mach mode speed control as well as IAS. This is loaded and run automatically via
the FSUIPC VRInsight facilities, set up as explained in another document
included with this package entitled "Lua plugins for VRInsight devices"
VRI_SetBaro.lua An example plugin for the VRInsight M-Panel to allow it to show the altimeter
BARO setting in millibars (hectoPascals) as a switchable alternative to inches.
This is loaded and run automatically via the FSUIPC VRInsight facilities, set up
as explained in another document included with this package entitled "Lua
plugins for VRInsight devices"
F1MustangSwCtl.zip Contains a Lua plugin for FSX to emulate certain mouse click controls for the
Flight1 Cessna Mustang subpanel and console switches, along with an
"ipcReady.lua" to show one way to get it loaded ready for use. Contributed by G
C McMillen, with thanks.
ThrustSym.lua, ThrustSym4.lua, SyncAxis.lua
Lua plug-ins which actively synchronise thrust settings (and other levers in the
case of "SyncAxis") by setting the best intermediate value when the levers are
close enough (within a specified distance). These have been kindly donated by
support forum user "Muas", with thanks.
WP6.lua A demonstration of the indicator brightness and colour setting facilities for the
GoFlight GF-WP-6 module.
MyDisplay.lua For WideClient only (6.895 or later). This is an example for the display library
functions, displaying and updating an assortment of FS values, including, if Radar
Contact 4 is running, a decode of the waypoint and runway lines from RC's menu.
Just place the file into the same folder as your WideClient. It will start when FS is
ready to fly and WideClient is fully connected.
Frictions.lua, DynamicFriction.lua
For FSUIPC4 only, these set the frictional coefficients in FSX's SIM1.DLL to
those originally recommended in the AVSIM FSX forum discussing these. The
ones set are those originally determined by Johan Dees. These plug-ins are here as
examples -- there will likely be improved sets of values available by now.
TextMenu.lua A plug-in for WideClient (6.997 or later) demonstrating the event.textmenu
function. It handles client displays of FSUIPC texts (like Radar Contact menus)
and SimConnect texts and menus arriving from SimConnect applications. These
facilities need FSUIPC 4.905 or later, a parameter adding to the FSUIPC4.INI file
("InterceptTextMenu=Yes"), and FSX SP2 or Acceleration (not currently either
SP1 or Prepar3D).
mrudder Rudder control by mouse: An example of the use of the mouse library in
conjunction with the extensive mouse events in the event library (FSUIPC4 only).
The rudder control action can be enabled and disabled via a button or key
assignment, and operates when the right mouse button is held down. The mouse
position is returned after action, and whilst the rudder control is operating the
horizontal position of the pointer in the FS screen shows the rudder position.
VAS Monitor.lua This plug-in provides a Lua display window on the FS screen (but undockable)
which shows the frame rate, the free memory, the maximum free memory block,
and the number of AI Traffic.
VAS monitor WideFS.lua is a version of the previous one but usable under WideClient to provide a
display on the Networked PC rather than the FS PC.
Other Lua libraries which may be useful with FSUIPC and Flight Simulator
Often Lua libraries are provided as Lua files or DLLs, and have to be brought into your project using "require". When using these you should
create a sub-folder in the FS Modules folder called "Lua" or "DLL" (either will work). Place the additional libraries into one of those -- ideally
Lua libraries into the Lua subfolder, and DLL libraries into the DLL sub-folder (though DLLs can also go into the Lua subfolder if you wish).
Libraries written in Lua should not normally be placed into the Modules folder tself because then they would be assignable in FSUIPC
assignments drop-downs, and running them directly in FSUIPC just won't work.
Here are links to some libraries which folks have told me about:
http://www.super-hornet.com/download/ saitek.dll, a library for Saitek display units, by Chris Apers.
http://ittner.github.com/lua-gd/ gd.dll, a library for graphics, by Thomas Boutell and Alexandre Ittner.
https://github.com/davidm/luacom/ luacom.dll, allows Lua programs to use and implement objects that follow Microsoft's COM (Component
Object Model) specification and ActiveX technology. For a good example refer to my Support forum's User
Contributions subforum, the item on Pokeys Device interfacing by "tlhflfsx".
Note that these are highly technical and aimed at reasonably experienced programmers.