Board index FlightGear Support Flying

Keyboard bindings: set more than 1 property  Topic is solved

Controlling your aircraft, using the autopilot etc.

Keyboard bindings: set more than 1 property

Postby mhab » Sat May 04, 2013 8:25 pm

High

I want to create a keyboard binding to reset all trims (elevator, aileron, rudder).
I found how to reset one trim:

Code: Select all
 <key n="53">
  <name>5</name>
  <desc>Trim neutral</desc>
  <binding>
  <command>property-assign</command>
  <property>/controls/flight/elevator-trim</property>
  <value type="double">0.0</value>
  </binding>
 </key>


My question now is: How do I have to do the binding if I want to set 3 different properties with the same key ?

Thanks for any advice
Mike-DE
mhab
 
Posts: 405
Joined: Thu Apr 18, 2013 10:59 pm
Callsign: D-MIKE
Version: 2017.1.2
OS: Win7

Re: Keyboard bindings: set more than 1 property

Postby jam007 » Sat May 04, 2013 8:33 pm

Think you can have multiple bindings to one key: http://wiki.flightgear.org/Bindings
jam007
 
Posts: 477
Joined: Sun Dec 16, 2012 10:04 am
Location: Uppsala, Sweden
Version: 2017.3.1
OS: Ubuntu 16.04

Re: Keyboard bindings: set more than 1 property  

Postby sim » Sat May 04, 2013 8:55 pm

Simple! This may do the job. Try it and report if it works! Reckon jam007 is right!
Set my joystick xml button code to do the same thing ages ago but it ain't a good thing to
do while flying near the deck.....you may crash!

<key n="53">
<name>5</name>
<desc>All Trims neutral</desc>
<binding>
<command>property-assign</command>
<property>/controls/flight/elevator-trim</property>
<value type="double">0.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/flight/aileron-trim</property>
<value type="double">0.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/flight/rudder-trim</property>
<value type="double">0.0</value>
</binding>
</key>

You can indeed use just one key or one joystick button to zero all three trims
and loads of other things too!! Just collect the appropriate scripts and add 'em! :D
Last edited by sim on Sat May 04, 2013 9:11 pm, edited 2 times in total.
User avatar
sim
 
Posts: 1439
Joined: Tue Jun 30, 2009 2:13 pm
Location: Shropshire England
Callsign: Fly4Fun
Version: 0.9.10 up
OS: 64 Win 10 HD6450

Re: Keyboard bindings: set more than 1 property

Postby Hooray » Sat May 04, 2013 9:06 pm

exactamente
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11317
Joined: Tue Mar 25, 2008 8:40 am

Re: Keyboard bindings: set more than 1 property

Postby mhab » Sat May 04, 2013 9:35 pm

Hello guys

Thanks a lot. I mixed up the XML tags and in the docu I couldn't find an example. It works perfectly.

It is really great to be in this community.

Mike-DE
mhab
 
Posts: 405
Joined: Thu Apr 18, 2013 10:59 pm
Callsign: D-MIKE
Version: 2017.1.2
OS: Win7

Re: Keyboard bindings: set more than 1 property

Postby Johan G » Sun May 05, 2013 12:38 am

sim wrote in Sat May 04, 2013 8:55 pm:Set my joystick xml button code to do the same thing ages ago but it ain't a good thing to
do while flying near the deck.....you may crash!

Isn't there a xml function that take an input property and a transition time to make smooth change. Unfortunately I do not find it on the wiki (for such things there are so many places with slightly different ways to present how things are done and how they work, and it's quite late here).
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: 5451
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

Re: Keyboard bindings: set more than 1 property

Postby Philosopher » Sun May 05, 2013 12:51 am

Go to bed Johan ;). The fgcommand name is "property-interpolate" and you can specify a <property>, <value> nodes, and either <time> or <rate> nodes (in seconds or delta value per second, respectively) with matching indicies to the <value>s. Example:
Code: Select all
<binding>
    <command>property-interpolate</command>
    <property>/controls/flight/aileron-trim</property>
    <value type="double">0</value>
    <rate>0.5</rate><!-- 2 seconds to 0 from 1 or -1 -->
</binding>


EDIT: And also you can replace each <value> with another <property> (mutually exclusive: do not use both!), and the properties from n="1" and on will be used as <value>s. Example:
Code: Select all
<binding>
    <command>property-interpolate</command>
    <property>/controls/flight/aileron-trim</property>
    <property>/controls/flight/default-aileron-trim</property><!-- the value to interpolate to -->
    <rate>0.5</rate><!-- 2 seconds to 0 from 1 or -1 -->
</binding>
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Keyboard bindings: set more than 1 property

Postby Johan G » Sun May 05, 2013 1:13 am

Philosopher wrote in Sun May 05, 2013 12:51 am:Go to bed Johan ;).

I'd better do that, it's now 3 pm am over here... :roll: zzZZ (In other words, I have read all new posts...) :wink:

EDIT: am, not pm... late night...
Last edited by Johan G on Sun May 05, 2013 4:05 pm, edited 2 times in total.
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: 5451
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

Re: Keyboard bindings: set more than 1 property

Postby jam007 » Sun May 05, 2013 8:36 am

Philosopher wrote in Sun May 05, 2013 12:51 am:"property-interpolate"

Hm, this was not listed in the wiki! Now it is...

Are there more "hidden" bindings?
jam007
 
Posts: 477
Joined: Sun Dec 16, 2012 10:04 am
Location: Uppsala, Sweden
Version: 2017.3.1
OS: Ubuntu 16.04

Re: Keyboard bindings: set more than 1 property

Postby Philosopher » Sun May 05, 2013 11:59 am

Sure, have fun ;): http://mapserver.flightgear.org/git/?p= ... cb;hb=HEAD.

BTW, thanks for adding it to the wiki!
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Keyboard bindings: set more than 1 property

Postby jam007 » Sun May 05, 2013 1:30 pm

How does play-audio-sample work?
Did a few tests but heard no sound nor saw any error-massages...
It would be useful for relay clicking sounds etc.

Noticed also that the README.commands in GIT seems rather old: Last revised: 2007-12-01
jam007
 
Posts: 477
Joined: Sun Dec 16, 2012 10:04 am
Location: Uppsala, Sweden
Version: 2017.3.1
OS: Ubuntu 16.04

Re: Keyboard bindings: set more than 1 property

Postby Gijs » Sun May 05, 2013 1:44 pm

See Nasal/atc-chatter/atc-chatter.nas (which is what this command was initially written for IIRC).

PS: Not sure which repository you're looking at, but Docs/README.commands from fgdata was last touched 2012-09-06 ;-)
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9362
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Keyboard bindings: set more than 1 property

Postby jam007 » Sun May 05, 2013 2:10 pm

I get a 500 server rerror when trying to open README.commands online at the momeent. But I looked at my local copy of fgdata that should be 1-2 weeks old. (Not older than 25/2-13 since I downloaded fgdata from gitourious then and started with git.) In the beginning of the file it states: Last revised: 2007-12-01 :?

Edit:
Code: Select all
if(vol == nil){vol = 0.5;}
        tmpl = { path : chatter_dir, file : chatter_list[chatter_index] , volume : vol};
        if ( getprop("/sim/sound/chatter/enabled") ) {
            # go through the motions, but only schedule the message to play
            # if atc-chatter is enabled.
            printlog("info", "update atc chatter ", chatter_list[chatter_index] );
       fgcommand("play-audio-sample", props.Node.new(tmpl) );
        }
    } else {
        # skip non-wav file found in directory
    }

Seems only to work with atc-chatter enabled...
Last edited by jam007 on Sun May 05, 2013 2:16 pm, edited 1 time in total.
jam007
 
Posts: 477
Joined: Sun Dec 16, 2012 10:04 am
Location: Uppsala, Sweden
Version: 2017.3.1
OS: Ubuntu 16.04

Re: Keyboard bindings: set more than 1 property

Postby Gijs » Sun May 05, 2013 2:15 pm

Haha, never trust dates mentioned inside documents. Git history is a much more reliable indication :-)
http://mapserver.flightgear.org/git/?p= ... 9d;hb=HEAD
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9362
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10


Return to Flying

Who is online

Users browsing this forum: No registered users and 2 guests

cron