HELP MENU:

Joystick/Rudders/Flight Control Support:

Could you imagine a pilot in his or her Cessna controlling the machine with a keyboard alone? For getting the proper feeling of flight you will need a joystick/yoke plus rudder pedals, right? However, the combination of numerous types of joysticks, flightsticks, yokes, pedals etc. the market with the several target operating systems, makes joystick support a nontrivial task in ProFlightSimulator

We are adding one-click joystick installation and syncing in our next update ( 2 months time)

ProFlightSimulator has integrated joystick support, which automatically detects any joystick, yoke, or pedals attached. Just try it! If this does work for you, lean back and be happy! You can see what ProFlightSimulator has detected your joystick as by selecting Help -> Joystick Information from the menu.

Unfortunately, given the several combinations of operating systems supported by ProFlightSimulator (possibly in foreign languages) and joysticks available, chances are your joystick does not work out of the box. Basically, there are two alternative approaches to get it going, with the first one being preferred.

Contents

Built-in joystick support

General remarks

In order for joystick auto-detection to work, a joystick bindings xml file must exist for each joystick. This file describes what axes and buttons are to be used to control which functions in ProFlightSimulator. The associations between functions and axes or buttons are called “bindings”. This bindings file can have any name as long as a corresponding entry exists in the joysticks description file

/ProFlightSimulator/joysticks.xml

which tells ProFlightSimulator where to look for all the bindings files. We will look at examples later.

ProFlightSimulator includes several such bindings files for several joystick manufacturers in folders named for each manufacturer. For example, if you have a CH Products joystick, look in the folder

/ProFlightSimulator/Input/Joysticks/CH

for a file that might work for your joystick. If such a file exists and your joystick is working with other applications, then it should work with ProFlightSimulator the first time you run it. If such a file does not exist, then we will discuss in a later section how to create such a file by cutting and pasting bindings from the examples that are included with ProFlightSimulator.

USB Joysticks Fail To Work?

ProFlight is designed to recognize automatically any USB joystick that it is aware of (has a configuration on file for it). Configuration for USB joysticks is located in the Inputs folder. For example:

Input/Saitek/X45.xml
        

The name reported by the joystick through the hardware of your system must match the name specified in the configuration file. If the stick identifies itself as

Saitek Saitek X45 Flight Control Stick
        

but the configuration file specifies

Saitek X45 USB Flight Stick
        

it will fail to recognize it.

This happens with some frequency. It has been known for the same stick in a manufacturer's line to report different identifier strings. If you encounter a problem getting your usb stick to be recognized by ProFlight, it is helpful to first check to see

  • a configuration file matching the name of your stick exists
  • the configuration joystick name matches the name the stick actually reports to your computer

Customizing Your Joystick

Q1: Why does my joystick seem messed up? I run on Windows [XP / Vista].
Q2: How can I change the controls assigned to each button on my joystick?


1. How PFS handles joysticks.
In layman's terms, PFS firsts attempts to detect whether a joystick is connected, and if so, what it is called. After checking /ProFlightSimulator/data/joysticks.xml for any instructions to the contrary, it will then scan through all of the various XML files under /ProFlightSimulator/data/Input/Joysticks looking for an XML file which defines "bindings" (i.e. command or control assignments for each axis and button) for that particular joystick. For example, if the stick is being reported as a "Saitek ST290 Pro", ProFlightSimulator will come across the file /ProFlightSimulator/data/Input/Joysticks/Saitek/ST290-Pro.xml which contains the tags:

<name>Saitek ST290 Pro</name>
<name>SAITEK Saitek ST290 Pro</name>

.. and it will use the control assignments found in that file to assign functions to each axis and button.

If it doesn't find an XML file for your particular joystick, it will substitute a "generic" one (/ProFlightSimulator/data/Input/Joysticks/Default/) which only maps the basic functions of elevator, aileron, rudder (if available), throttle, brakes, and elevator trim. Those assignments may or may not end up in logical-seeming places for your joystick.

2. The problem, as "caused" by Windows XP/Vista.
It seems as if Windows XP and/or Vista tend to report all joystick names as "Microsoft PC-Joystick Driver" regardless of what they are. This may or may not hold true if the user has taken the time to install the manufacturer's specific driver for that device; all feedback we have received so far seems to indicate that Windows defaults to a "generic" MS driver regardless, but your mileage may vary.

If the name is being mis-reported, this then prevents ProFlightSimulator from automatically assigning controls logically (using one of its many pre-defined XML bindings files) based on how the various axis numbers are assigned and how the buttons are laid out. ProFlightSimulator will then revert to the "generic" (aka default) bindings. For some joysticks the default file might make perfect sense; for others, it might cause odd behavior.

3. The solution; several different approaches.
There are three main solutions to this issue; however, both are similar in that they involve modifying one or more of the .xml files contained under/data/, and that they are both "temporary" solutions which are only good as long as you continue to use the same joystick. If you should change joysticks, you will have to re-employ this solution to allow ProFlightSimulator to assign the appropriate "new" XML bindings.

Wordpad is the recommended Windows application with which to do the modification,

a. Force the Name issue.
The first solution to this issue is to add the name "Microsoft PC-Joystick Driver" to whichever XML bindings file you wish to use. In the above example, you have a Saitek ST290 Pro joystick and would like to use the bindings file which PFS provides. In /ProFlightSimulator/data/Input/Joysticks/Saitek/ST290-Pro.xml, where you see the following:

<name>Saitek ST290 Pro</name>
<name>SAITEK Saitek ST290 Pro</name>

... you would want to add a third <name> tag, the result reading as thus:

<name>Saitek ST290 Pro</name>
<name>SAITEK Saitek ST290 Pro</name>
<name>Microsoft PC-Joystick Driver</name>

Thereafter, when PFS reads your joystick name as "Microsoft PC-Joystick Driver" and finds the tag <name>Microsoft PC-Joystick Driver</name> in /ProFlightSimulator/data/Input/Joysticks/Saitek/ST290-Pro.xml, it will then use that file to assign controls.

b. Override the automatic selection.
Recall in the initial explanation that before ProFlightSimulator begins scanning through XML files in /ProFlightSimulator/data/Input/Joysticks/, it first checks /ProFlightSimulator/data/joysticks.xml for any overriding instructions? This is where you can manually supersede its automatic assignment with a manually-specified filename. You will need to know which virtual position your joystick is in; js_demo will tell you, but if not, you can usually assume "0" and then try other values if the results don't seem to work out. To specify the joystick in position "0" is a Saitek ST-290 Pro, and that you wish to use the XML bindings file PFS provides for that model, you would add the following to /ProFlightSimulator/data/joysticks.xml, in between the <PropertyList> tags:

<PropertyList>
<js n="0" include="Input/Joysticks/Saitek/ST290-Pro.xml"/>
</PropertyList>

c. Create your own custom control assignments.
My preferred way to deal with joystick axis and button assignments has been to create my own customized bindings file and point js n="0" to it using the method shown above. I start by opening the bindings file for my model of joystick and then re-saving it as /ProFlightSimulator/data/Input/Joysticks/custom.xml, and then changing /ProFlightSimulator/data/joysticks.xml to read as follows (and you can remove EVERYTHING except what's shown here):

<PropertyList>
<js n="0" include="Input/Joysticks/custom.xml"/>
</PropertyList>

In that custom.xml file, I then take note of what controls are currently assigned to each axis and button and make notes as to where each one is physically located. (NOTE: some joysticks have numbers printed on each button; however, those numbers do not necessarily correspond to the numbers that the software assigns to them. The ST290 Pro is an excellent example of this.) Alternately I could use js_demo.exe, if available, to determine which axis and which button are given what numbers.

Then, I use the existing XML file as a template, but modify what appears between each set of <binding></binding> tags to suit my needs. There are many examples of how to accomplish each desired action, and these may be found in the other included XML joystick binding files.

    For joysticks that have no rudder control (twist axis), I've seen (a) a binding which automatically changes the left/right stick movement to control the rudder instead of the ailerons when on the ground, as well as (b) a binding that allowed for "auto-coordination" of aileron and rudder controls ONLY while a certain button was depressed (again, to improve ground steering).

    For joysticks which have the rudder on twist but don't have the ability to command left- and right-hand wheelbrakes independently (i.e. the wheelbrakes are only available in an on-off mode), I personally have a script with a formula so that when I am simultaneously braking and steering with rudder, the wheelbrakes are applied differentially to assist in ground steering.

    For gear-up and down, I personally have a binding which coordinates this with the arrestor hook used in aircraft carrier operations. I also include a ground-altitude check, so that the gear cannot be commanded "up" via joystick when the aircraft is on the ground.

    I have seen a binding for a button which, while depressed momentarily, allows the pilot view (cockpit view) to "glance down" at the instrument panel -- a very useful function in aircraft where certain critical gauges are below the default field-of-view.


Verifying your joystick is working

Does your computer see your joystick? One way to answer this question under Linux is to reboot your system and immediately enter on the command line

dmesg | grep Joystick 
        

which pipes the boot message to grep which then prints every line in the boot message that contains the string “Joystick”. When you do this with a Saitek joystick attached, you will see a line similar to this one:

input0: USB HID v1.00 Joystick [SAITEK CYBORG 3D USB] on usb2:3.0 
        

This line tells us that a joystick has identified itself as SAITEK CYBORG 3D USB to the operating system. It does not tell us that the joystick driver sees your joystick. If you are working under Windows, the method above does not work. Go to Start > Controlpanel > Game Controller instead and see whether the dialog displays (and responses) on your joystick.

Confirming that the driver recognizes your joystick

ProFlightSimulator ships with a utility called js_demo. It will report the number of joysticks attached to a system, their respective “names”, and their capabilities. Under Linux, you can run js_demo from the folder /ProFlightSimulator/bin as follows:

$ cd /usr/local/ProFlightSimulator/bin 
$ js_demo 
        

Under Windows, open a command shell (Start > All Programs > Accessories > Command Prompt), go to the ProFlightSimulator binary folder and start the program as follows (given ProFlightSimulator is installed under C:/Program Files/Flight Productions/ProFlightSimulator)

C:
cd /Program Files/Flight Productions/ProFlightSimulator/bin/win32 
js_demo.exe 
        

If js_demo.exe is not included in your version, download it here.

On our system, the first few lines of output are (stop the program with C if it is quickly scrolling past your window!) as follows:

Joystick test program. 
Joystick 0: “CH PRODUCTS CH FLIGHT SIM YOKE USB ” 
Joystick 1: “CH PRODUCTS CH PRO PEDALS USB” 
Joystick 2 not detected 
Joystick 3 not detected 
Joystick 4 not detected 
Joystick 5 not detected 
Joystick 6 not detected 
Joystick 7 not detected 
+——————–JS.0———————-+——————–JS.1———————-+ 
| Btns Ax:0 Ax:1 Ax:2 Ax:3 Ax:4 Ax:5 Ax:6 | Btns Ax:0 Ax:1 Ax:2 | 
+———————————————-+———————————————-+ 
| 0000 +0.0 +0.0 +1.0 -1.0 -1.0 +0.0 +0.0 . | 0000 -1.0 -1.0 -1.0 . . . . . | 
        


First note that js demo reports which number is assigned to each joystick recognized by the driver. Also, note that the “name” each joystick reports is also included between quotes. We will need the names for each bindings file when we begin writing the binding xml files for each joystick.

Identifying the numbering of axes and buttons

Axis and button numbers can be identified using js demo as follows. By observing the output of js demo while working your joystick axes and buttons you can determine what axis and button numbers are assigned to each joystick axis and button. It should be noted that numbering generally starts with zero.

The buttons are handled internally as a binary number in which bit 0 (the least significant bit) represents button 0, bit 1 represents button 1, etc., but this number is displayed on the screen in hexadecimal notation, so:

  • 0001 ⇒ button 0 pressed
  • 0002 ⇒ button 1 pressed
  • 0004 ⇒ button 2 pressed
  • 0008 ⇒ button 3 pressed
  • 0010 ⇒ button 4 pressed
  • 0020 ⇒ button 5 pressed
  • 0040 ⇒ button 6 pressed
  • ... etcp to ...
  • 8000 ⇒ button 15 pressed
  • ... and ...
  • 0014 ⇒ buttons 2 and 4 pressed simultaneously
  • ... etc.

For Linux users, there is another option for identifying the “name” and the numbers assigned to each axis and button. Most Linux distributions include a very handy program, “jstest”. With a CH Product Yoke plugged into the system, the following output lines are displayed by jstest:

jstest /dev/js3 
Joystick (CH PRODUCTS CH FLIGHT SIM YOKE USB ) 
has 7 axes and 12 buttons. Driver version is 2.1.0 Testing…(interrupt to exit) Axes: 0: 0 1: 0 2: 0 3: 0 4: 0 5: 0 6: 0
Buttons: 0:off 1:off 2:off 3:on 4:off 5:off 6:off 7:off 8:off 9:off 10:off 11:off

Note the “name” between parentheses. This is the name the system associates with your joystick.

When you move any control, the numbers change after the axis number corresponding to that moving control and when you depress any button, the “off” after the button number corresponding to the button pressed changes to “on”. In this way, you can quickly write down the axes numbers and button numbers for each function without messing with binary.

Writing or editing joystick binding xml files

At this point, you have confirmed that the operating system and the joystick driver both recognize your joystick(s). You also know of several ways to identify the joystick “name” your joystick reports to the driver and operating system. You will need a written list of what control functions you wish to have assigned to which axis and button and the corresponding numbers.

Make the following table from what you learned from js demo or jstest above (pencil and paper is fine). Here we assume there are 5 axes including 2 axes associated with the hat.

Axis Button
elevator = 0 view cycle = 0
rudder = 1 all brakes = 1
aileron = 2 up trim = 2
throttle = 3 down trim = 3
leftright hat = 4 extend flaps = 4
foreaft hat = 5 retract flaps = 5
decrease RPM = 6
increase RPM = 7

We will assume that our hypothetical joystick supplies the “name” QUICK STICK 3D USB to the system and driver. With all the examples included with ProFlightSimulator, the easiest way to get a so far unsupported joystick to be auto detected, is to edit an existing binding xml file. Look at the xml files in the sub-folders of /ProFlightSimulator/Input/Joysticks/. After evaluating several of the xml binding files supplied with ProFlightSimulator, we decide to edit the file

/ProFlightSimulator/Input/Joysticks/Saitek/Cyborg-Gold-3d-USB.xml.

This file has all the axes functions above assigned to axes and all the button functions above assigned to buttons. This makes our editing almost trivial.

Before we begin to edit, we need to choose a name for our bindings xml file, create the folder for the QS joysticks, and copy the original xml file into this directory with this name.

$ cd /usr/local/ProFlightSimulator/Input/Joysticks 
$ mkdir QS 
$ cd QS 
$ cp /usr/local/ProFlightSimulator/Input/Joysticks/Saitek/ 
Cyborg-Gold-3d-USB.xml QuickStick.xml 
        

Here, we obviously have supposed a Linux/UNIX system with ProFlightSimulator being installed under /usr/local/ProFlightSimulator. For a similar procedure under Windows with ProFlightSimulator being installed under C:/Program Files/ProFlightSimulator, open a command shell and type

C: 
cd /Program Files/Flight Productions/ProFlightSimulator/Input/Joysticks 
mkdir QS 
cd QS 
copy /ProFlightSimulator/Input/Joysticks/Saitek/ 
Cyborg-Gold-3d-USB.xml QuickStick.xml 
        

Next, open QuickStick.xml with your favorite editor. Before we forget to change the joystick name, search for the line containing <name>. You should find the line

<name>SAITEK CYBORG 3D USB</name> 
        

and change it to

<name>QUICK STICK 3D USB</name>
        

This line illustrates a key feature of xml statements. They begin with a <tag> and end with a </tag>.

You can now compare your table to the comment table at the top of your file copy. Note that the comments tell us that the Saitek elevator was assigned to axis 1. Search for the string

<axis n=~1~> 
        

and change this to

<axis n=~0~>
        

Next, note that the Saitek rudder was assigned to axis 2. Search for the string

<axis n=~2~> 
        

and change this to

<axis n=~1~> 
        

Continue comparing your table with the comment table for the Saitek and changing the axis numbers and button numbers accordingly. Since QUICKSTICK USB and the Saitek have the same number of axes but different number of buttons, you must delete the buttons left over. Just remember to double check that you have a closing tag for each opening tag or you will get an error using the file.

Finally, be good to yourself (and others when you submit your new binding file to a ProFlightSimulator developers or users archive!), take the time to change the comment table in the edited file to match your changed axis and button assignments. The new comments should match the table you made from the js demo output. Save your edits.

Several users have reported that the numbers of axes and buttons assigned to functions may be different with the same joystick under Windows and Linux. The above procedure should allow one to easily change a binding xml file created for a different operating system for use by their operating system.

The view keeps moving left or is revolving/spinning when using joystick

This is a common issue if you're using Saitek joysticks and there is a solution for this - you'll need a new Saitek XML binding file.

Right Click Here To Download The Saitek XML file

Then all you need to do is to simply copy the file and overwrite the original one into your C:\Program Files\Flight Productions\ProFlightSimulator\data\Input\Joysticks\Saitek folder.

This will stop the error from occurring.

Telling ProFlightSimulator about your new bindings xml file

Before ProFlightSimulator can use your new xml file, you need to edit the file

/ProFlightSimulator/joysticks.xml,

adding a line that will include your new file if the “name” you entered between the name tags matches the name supplied to the driver by your joystick. Add the following line to joysticks.xml.

<js-named include=~Input/Joysticks/QS/QuickStick.xml~/> 
        

You can tell how ProFlightSimulator has interpretted your joystick setup by selecting Help -> Joystick Information from the Menu.

Some hints for Windows users

Basically, the procedures described above should work for Windows as well. If your joystick/yoke/pedals work out of the box or if you get it to work using the methods above, fine. Unfortunately there may be a few problems.

The first one concerns users of non-US Windows versions. As stated above, you can get the name of the joystick from the program js demo. If you have a non-US version of Windows and the joystick .xml files named above do not contain that special name, just add it on top of the appropriate file in the style of

<name>Microsoft-PC-Joysticktreiber </name> 
        

No new entry in the base joysticks.xml file is required.

Unfortunately, there is one more loophole with Windows joystick support. In case you have two USB devices attached (for instance a yoke plus pedals), there may be cases, where the same driver name is reported twice. In this case, you can get at least the yoke to work by assigning it number 0 (out of 0 and 1). For this purpose, rotate the yoke (aileron control) and observe the output of js demo. If figures in the first group of colons (for device 0) change, assignment is correct. If figures in the second group of colons (for device 1) change, you have to make the yoke the preferred device first. For doing so, enter the Windows “Control panel”, open “Game controllers” and select the “Advanced” button. Here you can select the yoke as the “Preferred” device. Afterward you can check that assignment by running js demo again. The yoke should now control the first group of figures.

Unfortunately, we did not find a way to get the pedals to work, too, that way. Thus, in cases like this one (and others) you may want to try an alternative method of assigning joystick controls.

Joystick support via .fgfsrc entries

Fortunately, there is a tool available now, which takes most of the burden from the average user who, maybe, is not that experienced with XML, the language which these files are written in.

For configuring your joystick using this approach, open a command shell (command prompt under windows, to be found under Start|All programs|Accessories). Change to the directory /ProFlightSimulator/bin via e.g. (modify to your path)

cd C:/Program Files/Flight Productions/ProFlightSimulator/bin
        

and invoke the tool fgjs via

./fgjs
        

on a UNIX/Linux machine, or via

fgjs
        

on a Windows machine. The program will tell you which joysticks, if any, were detected. Now follow the commands given on screen, i.eṁove the axis and press the buttons as required. Be careful, a minor touch already “counts” as a movement. Check the reports on screen. If you feel something went wrong, just re-start the program.

After you are done with all the axis and switches, the directory above will hold a file called fgfsrc.js. If the ProFlightSimulator base directory ProFlightSimulator does not already contain an options file .fgfsrc (under UNIX)/system.fgfsrc (under Windows) mentioned above, just copy

fgfsrc.js into .fgfsrc (UNIX)/system.fgfsrc (Windows)

and place it into the directory ProFlightSimulator base directory ProFlightSimulator. In case you already wrote an options file, just open it as well as fgfsrc.js with an editor and copy the entries from fgfsrc.js into .fgfsrc/system.fgfsrc. One hint: The output of fgjs is UNIX formatted. As a result, Windows Editor may not display it the proper way. I suggest getting an editor being able to handle UNIX files as well (and oldie but goldie in this respect is PFE, just make a web search for it). My favorite freeware file editor for that purpose, although somewhat dated, is still PFE, to be obtained from

http://www.lancs.ac.uk/people/cpaap/pfe/.

The the axis/button assignment of fgjs should, at least, get the axis assignments right, its output may need some tweaking. There may be axes moving the opposite way they should, the dead zones may be too small etc. For instance, I had to change

–prop:/input/joysticks/js[1]/axis[1]/binding/factor=-1.0 
        

into

–prop:/input/joysticks/js[1]/axis[1]/binding/factor=1.0 
        

(USB CH Flightsim Yoke under Windows XP). Thus, here is a short introduction into the assignments of joystick properties.

Basically, all axes settings are specified via lines having the following structure:

--prop:/input/joysticks/js[n]/axis[m]/binding 
/command=property-scale (one line) 
--prop:/input/joysticks/js[n]/axis[m]/binding 
/property=/controls/steering option (one line) 
--prop:/input/joysticks/js[n]/axis[m]/binding 
/dead-band=db (one line) 
--prop:/input/joysticks/js[n]/axis[m]/binding 
/offset=os (one line) 
--prop:/input/joysticks/js[n]/axis[m]/binding 
/factor=fa (one line) 
        

where

n number of device (usually starting with 0)
m number of axis (usually starting with 0)
steering option elevator, aileron, rudder, throttle, mixture, pitch
dead-band range, within which signals are discarded; useful to avoid jittering for minor yoke movements
offset specifies, if device not centered in its neutral position
factor controls sensitivity of that axis; defaults to +1, with a value of -1 reversing the behavior

You should be able to at least get your joystick working along these lines. Concerning all the finer points, for instance, getting the joystick buttons working, John Check has written a very useful README being included in the base package to be found under ProFlightSimulator/Docs/Readme/Joystick.html. In case of any trouble with your input device, it is highly recommended to have a look into this document.

More about programming joystick XML files

General tips

  • When testing a new xml file it is best to start ProFlightSimulator via a command window (rather than the GUI interface). Any error messages will then be displayed in the terminal. Error messages will give both a message and a line number, helping you pinpoint any errors.
  • Errors can be detected on initial startup or at runtime. Both types of errors will be displayed in the terminal.
  • One of the most common errors is including a character that makes XML choke. Such characters include
& < --
        

These characters will cause problems even if simply included in comments or within scripts.

  • If your scripts contain any of these characters, you have to enclose the scripts in <script><![CDATA[...]]></script>. Alternatively, you can 'escape' the characters, ie "<" becomes "<".
  • Note that as of ver 1.9.1 there appears to be no way to tell ProFlightSimulator to reload joystick files at runtime. So to test any changes to your file you must exit ProFlightSimulator and re-start, a somewhat time-consuming process.
  • You can find many examples of different ways to program joysticks simply by examining the joystick xml files that are packaged with ProFlightSimulator. See the directory ProFlightSimulator/data/input/joysticks
  • You can explore the internal property tree to see many variables that can be altered using joystick buttons or axes (File/Browse Internal Properties)
  • You can test bits of Nasal code and do some other useful things using the Nasal Console (Debug/Nasal Console).
  • All Nasal code shares a common namespace, so it's possible to set a variable in one nasal binding, and to read it in another.

Useful hints for scripts

Some particularly useful ideas for programming scripts within joystick XML files:

  • getprop and setprop can be used for getting & setting properties from the internal properties tree:
var brake = !getprop("/controls/gear/brake-parking");
setprop("/controls/gear/brake-parking", brake);
        
  • You can also make your own values on the property tree:
setprop("/input/joysticks/js[0]/myjoystick-modifier", 1);
var mod = getprop("/input/joysticks/js[0]/myjoystick-modifier");
        
  • You can print to terminal using the print function. This is very useful for debugging.
print("Just", " a ", "test");
        
  • You can display info in ProFlightSimulator via a popup. This is useful for giving the user feedback about changes that may not be obvious via the panel. It can also be useful for debugging. Example:
gui.popupTip("Parking Brake ON");
        

Arguments for gui.popupTip must be strings, so if you want to display other types of variables they should be formatted with something like sprintf:

gui.popupTip
(sprintf("Elevator trim: %d", 100 * getprop("/controls/flight/elevator-trim")));

Or

thv = getprop("/controls/engines/engine[0]/mixture");
gui.popupTip("Thrust vector " ~ int(thv * 120 - 20));
        
  • You can just start using variables, ie,
x = 10;
        

But for various reasons it is generally better to declare variables with the "var" statement:

var x = 10;
        

Note that "var" creates variables that are local in scope, which may cause problems if you are intending to use a variable globally among all different bindings in your joystick XML file.

  • You can include a section of script that runs on startup to initialize variables, create functions, etc. Example:
<PropertyList>
  <name type="string">My joystick name</name>
  <name type="string">My joystick name #2</name>
  <nasal>
    <script>
       #initialize variables
       f1 = f2 = 0;
       left_brake = right_brake = 0;
       # create a function to be used with all buttons
       getmod = func { getprop("/input/joysticks/js[0]/t-flight-hotas-x-modifier" ) }
    </script>
  </nasal>

Return To Top Of Page

Affiliates | Need Support?
Privacy Policy :: Disclaimer/Terms