Using a Nasal file with a joystick Part 2: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 16: Line 16:


For each button in your xml file, change your code. Here, the button is labelled "1". And remember, we are talking about the label printed on the joystick, not the button number assigned by the operating system.
For each button in your xml file, change your code. Here, the button is labelled "1". And remember, we are talking about the label printed on the joystick, not the button number assigned by the operating system.
<syntaxhighlight=php>
<syntaxhighlight lang="xml">
   <button n="xxx">
   <button n="xxx">
     <!-- Labled as 1 -->
     <!-- Labled as 1 -->

Revision as of 06:28, 4 February 2013

In Using a Nasal file with a joystick you saw how to get started. This article goes into it in more depth.


First Steps

Backup your xml file. Print it, you need to know which button does what. If you have a Nasal file, back it up too. If you haven't read the first part, read it and do the basic implementation now.


Modifying your xml file

This seems like a lot of work, but it is worth it in the end.

You need to use the labels of the buttons on your joystick. You will use these labels for the name of the Nasal function to call in your nasal file.

For each button in your xml file, change your code. Here, the button is labelled "1". And remember, we are talking about the label printed on the joystick, not the button number assigned by the operating system.

  <button n="xxx">
    <!-- Labled as 1 -->
    <desc>Whatever it does</desc>
    <binding>
      <command>nasal</command>
      <script>saitekyoke.button1()</script>
    </binding>
  </button>