Board index FlightGear Development

Keyboard binding

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Keyboard binding

Postby MIG29pilot » Tue Sep 15, 2015 10:37 pm

A. How does one assign a keyboard button to a certain task;
B. How does one change a keyboard button for a task;
C. How on earth does one figure which button one is telling the sim to use;
D. For instance, how do I make a command that uses "Ctrl-j" use "j" instead?
User avatar
MIG29pilot
 
Posts: 1454
Joined: Tue May 19, 2015 4:03 pm
Location: 6 feet under Snow
Callsign: MIG29pilot
Version: 3.7nightly
OS: Windows 10

Re: Keyboard binding

Postby legoboyvdlp » Tue Sep 15, 2015 10:47 pm

A. You assign the key to a property such as /gear/gear/spray/
User avatar
legoboyvdlp
 
Posts: 7111
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Keyboard binding

Postby Thorsten » Wed Sep 16, 2015 6:12 am

Code snipped calling a Nasal script when a key is used:

Code: Select all
       <key n="5">
        <name>Ctrl+e</name>
        <desc>Cutoff switch engine 3</desc>
        <binding>
            <command>nasal</command>
            <script>SpaceShuttle.ssme_cutoff(1)</script>
        </binding>
        </key>


Code snipped adjusting a property every time the key is pressed:
Code: Select all
          <key n="91">
                <name>[</name>
                <desc>Move rudder left</desc>
                <repeatable type="bool">true</repeatable>
                <binding>
                    <command>property-adjust</command>
                    <property>/controls/flight/rudder</property>
                    <step type="double">-0.05</step>
                </binding>
            </key>


These go under /input/keyboard in the aircraft-set.xml file).

All the keys have codes - so have shift+key and ctrl+key - there's probably a table somewhere, but so far I've just looked at keyboard.xml and counted the free spaces (ctrl+f would be '6' for instance, knowing the above).
Thorsten
 
Posts: 11113
Joined: Mon Nov 02, 2009 8:33 am

Re: Keyboard binding

Postby Johan G » Wed Sep 16, 2015 2:57 pm

This wiki article may be of help: Howto:Reassign keyboard bindings (perm) ;)
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5529
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest