Board index FlightGear Development Aircraft Systems

setting 2 proprties from one switch

Modeling aircraft systems, like electrical stuff, hydraulics, pneumatics? Feel free to ask support.

setting 2 proprties from one switch

Postby StuartC » Sun Jan 01, 2017 1:20 pm

Lets stay I want to set 2 properties ( property A + Property B )to on from a single single position switch

I know for a single propert the binding would be like:-

<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<property>propert A</property>
</binding>
</action>

But can you have more than one binding ?
StuartC
 
Posts: 2738
Joined: Fri Jun 18, 2010 8:18 pm
Location: Arse end of the Universe
Callsign: WF01
Version: 2018.3.2
OS: W10 64 bit

Re: setting 2 proprties from one switch

Postby erik » Sun Jan 01, 2017 1:57 pm

It certainly can be done with property rules:
http://wiki.flightgear.org/Autopilot_co ... figuration

I don't think it can be done directly from the animation.

Erik
erik
 
Posts: 1521
Joined: Thu Nov 01, 2007 1:41 pm

Re: setting 2 proprties from one switch

Postby sanhozay » Sun Jan 01, 2017 1:58 pm

I think you should just be able to repeat the binding section within the action:

Code: Select all
<action>
  <button>0</button>
  <repeatable>false</repeatable>
  <binding>
    <command>property-toggle</command>
    <property>propert A</property>
  </binding>
  <binding>
    <command>property-toggle</command>
    <property>propert B</property>
  </binding>
</action>
sanhozay
 
Posts: 1207
Joined: Thu Dec 26, 2013 11:57 am
Location: EGNM
Callsign: G-SHOZ
Version: Git
OS: Ubuntu 16.04

Re: setting 2 proprties from one switch

Postby Bomber » Sun Jan 01, 2017 2:03 pm

that's not a switch it's a keyboard binding...

why not use a switch with two outputs... ala


<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<property>property_A&B </property>
</binding>
</action>



<switch>
<default value="0"/>
<test value="1">
property_A&B EQ 1
</test>
<output>property_A</output>
<output>property_B</output>
</switch>

Simon
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchel
Bomber
 
Posts: 1934
Joined: Fri Dec 14, 2007 7:06 pm
OS: Windows XP and 10

Re: setting 2 proprties from one switch

Postby Thorsten » Sun Jan 01, 2017 3:07 pm

But can you have more than one binding ?


Yes, you can (even fairly complex ones). This

Code: Select all
        <action>
            <binding>
                <command>property-adjust</command>
                <property>/fdm/jsbsim/systems/apu/apu/hyd-circ-pump-cmd</property>
                <factor>1</factor>
                <min>-1</min>
                <max>1</max>
                <wrap>false</wrap>
            </binding>
            <binding>
                <command>nasal</command>
                <script>
         SpaceShuttle.click("avionics");
         var cmd = getprop("/fdm/jsbsim/systems/apu/apu/hyd-circ-pump-cmd");
         if (cmd == 0)
            {setprop("/fdm/jsbsim/systems/apu/apu/hyd-circ-pump-cmd-dlg", 1);}
         else {setprop("/fdm/jsbsim/systems/apu/apu/hyd-circ-pump-cmd-dlg", 0);}
      </script>
            </binding>
        </action>


is an example doing it (while the second binding here is Nasal - which you could also use to set a property - I believe I have also examples where the second binding is also a property adjust.
Thorsten
 
Posts: 11136
Joined: Mon Nov 02, 2009 8:33 am


Return to Systems

Who is online

Users browsing this forum: No registered users and 1 guest