Board index FlightGear Support Hardware

Adjust the viewing with an axis

Joysticks, pedals, monitors.

Re: Adjust the viewing with an axis

Postby Philosopher » Wed Mar 27, 2013 1:00 am

Thanks Sigmoid! I agree that your design is much more elegant, I admit that I wasn't quite a polished programmer and I might have been looking for an easy method to explain that didn't require too many typing (I write a lot on my iPod -- doesn't mean that I necessarily prefer it!). With regard to the loops, perhaps you could improve on my method by using the "loopid" method outlined here: http://wiki.flightgear.org/Nasal_Loops. It is a bit tricky for joysticks, for you don't know whether the initialization was run or not. Hence I think this method would work in the initialization section at the top:
Code: Select all
if (contains(caller(0)[0], "loopid"))
    loopid += 1;
else var loopid = 0;

Here caller(0) is the currently executing function which returns a vector, the index=0 of which is the local namespace as a hash (well, namespaces are hashes), and contains checks for a key in the has, aka a variable in the current namespace in this case. If we don't find it, then we want to create it with 0, but just increment it if it is already there. Make sense?
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

untested

Postby Hooray » Wed Mar 27, 2013 1:23 am

Code: Select all
var has_symbol = func(sym) contains(caller(1)[0], sym );
has_symbol ("loopid") and loopid += 1 or var loopid = 0;


(I actually started writing a really self-explanatory piece of code, trying to make the point that it would not need an explanation like yours then, but somehow I found this more appealing, especially given your background and Nasal related efforts :lol: )
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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Adjust the viewing with an axis

Postby Philosopher » Wed Mar 27, 2013 1:42 am

Whoa, that actually works! It looks very pythonic. Didn't know the binary operators actually worked together! Definitely something worth mentioning in our docs...

P.S. just be careful, loopid will start at 1 not 0 (the variable isn't defined, so you execute "loopid = 0" which returns false, so that the second half of the or statement has to be tried; remember, it is: «(defined and expr) or other_expr», and the first half is always is false!).
P.P.S. shoulda seen this, I think «and» and «or» are PREC_REVERSE, so it sees «expr0 or expr3» first and «expr1 and expr2» (aka expr0) is one of the sides of the «or».
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: Adjust the viewing with an axis

Postby Hooray » Wed Mar 27, 2013 1:52 am

Philosopher wrote in Wed Mar 27, 2013 1:42 am:Didn't know the binary operators actually worked together! Definitely something worth mentioning in our docs...



http://plausible.org/nasal/sample.nas
Andy wrote:# Nasal has no "statements", which means that any expression can appear
# in any context. This means that you can use an if/else clause to do
# what the ?: does in C. The last semicolon in a code block is
# optional, to make this prettier.


If something doesn't work accordingly, it's simply a bug :D
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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Adjust the viewing with an axis

Postby Basbar » Sat Feb 01, 2014 1:30 am

Pardon, am absolute NEWBIE @ Flightgear, just D/L the app 2.12.1 and the Aircraft list 2.12. I also have had for some time Saitek AV8R-01, but have not been using it much, just over Google Earth, because I had inferior computer/computing power. Now I'm cruising w. good Nvidia, 8 GB RAM and will refresh my Private Pilot [US] skills w. FlightGear. So much intro...
I have seen some examples of xtml coding in the forum for the Saitek: question: where do I copy and paste it? Just a hint, where to proceed, am quite computer savvy, thank you from Nepal.
Basbar
 
Posts: 1
Joined: Sat Feb 01, 2014 1:05 am

Re: Adjust the viewing with an axis

Postby macnab » Sat Feb 01, 2014 3:26 am

The xml file is under the folder where FG is installed in ...data/Input/Joysticks/Saitek

The file in question is aviator.xml

Make a backup of it first!!!
macnab
 
Posts: 885
Joined: Tue Aug 02, 2011 8:20 am
Location: Johannesburg, South Africa
Callsign: ZS-ILH
Version: Git
OS: Win7Pro 64bit SP1

Re: Adjust the viewing with an axis

Postby sim » Fri Oct 20, 2017 7:30 pm

Saitek AV8R-01 with 6 modifier states and rate of change of views controlled by Throttle 2 axis when mode switch A position is selected. 8)
Code: Select all
<?xml version="1.0"?>
<!--This xml is made for
the Saitek AV8R (Aviator) joystick on windows IT HAS 6 MODIFIER STATES 0 1 2 3 4 5 IN STATE 2 OR 3 THROTTLES WORK INDEPENDANTLY ON TWIN ENGINES -->

<PropertyList>
    <name type="string">Saitek AV8R joystick</name>
    <name type="string">Saitek Aviator Stick</name>
    <name type="string">Microsoft PC-joystick driver</name>
     <data>
      <mode type="int">0</mode>
 <modifier type="int">0</modifier>
   <throttle-mode type="int">0</throttle-mode>
</data>

   <nasal>
      <script><![CDATA[
         var self = cmdarg().getParent();
         var data = self.getNode("data");
         var mode = data.getNode("mode");
   var modifier = data.getNode("modifier");
 var throttle_mode = data.getNode("throttle-mode");f1 = f2 = f3 = 0;
left_brake = right_brake = 0;

get_mode = func { modifier.getValue() + mode.getValue() * 6 }

harrier = func {
if (getprop("/sim/aero") == "harrier") {
   thv = getprop("/controls/engines/engine[0]/mixture");
gui.popupTip("Thrust vector " ~ int(thv * 120 - 20));
}
}
 ]]></script>
 </nasal>


<axis n="0">
  <desc>Aileron:                   info Modifier ( 0 2 4 ) are Mode Switch ( Off  A  B ) respectively</desc>
 <dead-band type="double">0.15</dead-band> <tolerance type="double">0.02</tolerance> <binding>
   <command>property-scale</command>
   <property>/controls/flight/aileron</property>
   
   <offset type="double">0.0</offset>
   <squared type="bool">true</squared>
  </binding>
<high>
 <binding> <command>nasal</command>
 <script>f14.fixAirframe();</script>
</binding> </high>
<low>
 <binding> <command>nasal</command>
 <script>f14.fixAirframe();</script>
</binding> </low>
 </axis>

<axis n="1">
  <desc>Elevator:                 info Modifier ( 1 3 5 ) are Mode Switch ( Off  A  B )  + trigger</desc>
 
<tolerance type="double">0.04</tolerance> <dead-band type="double">0.09</dead-band>
 <binding>
   <command>property-scale</command>
   <property>/controls/flight/elevator</property>
      <offset type="double">0.0</offset>
   <factor type="double">-1.0</factor>
   <squared type="bool">true</squared>
  </binding>

 <high> <repeatable type="bool">false</repeatable>
<binding> <command>nasal</command>
 <script>setprop("instrumentation/nav/serviceable",0);setprop("instrumentation/nav[1]/serviceable",0);setprop("instrumentation/comm/serviceable",0);setprop("instrumentation/comm[1]/serviceable",0);setprop("instrumentation/adf/serviceable",0);</script>
</binding> </high>
 </axis>



<axis n="3"> <desc>Rudder</desc> <dead-band type="double">0.04</dead-band> <tolerance type="double">0.02</tolerance> <binding> <command>property-scale</command> <property>/controls/flight/rudder</property> <offset type="double">0.0</offset>
<factor type="double">1.0</factor>   <squared type="bool">true</squared> </binding> </axis>

<axis n="2">
<desc>THROTTLE 1  0145-All Engines          23-Left Engines,  X-Shut/Mix/Prop/Boost:reset </desc> <number>
<unix>3</unix>
<mac>2</mac>
<windows>2</windows>
</number>
 <repeatable type="bool">false</repeatable>
 <binding>
 <command>nasal</command>
 <script>
m = get_mode();
if (m == 0) {throttle_mode.setIntValue(0);
controls.throttleAxis();
} elsif (m == 1) {
controls.throttleAxis();} elsif (m == 2)
{throttle_mode.setIntValue(2);var val = cmdarg().getNode("setting").getValue();
       if (throttle_mode.getValue() == 2) {
throttle_mode.setIntValue(2);setprop("/controls/engines/engine[0]/throttle",
(1 - val)/2);
 }
} elsif (m == 3)
{throttle_mode.setIntValue(3);

var val = cmdarg().getNode("setting").getValue();
       if (throttle_mode.getValue() == 3) {throttle_mode.setIntValue(3);setprop("/controls/engines/engine[0]/throttle",
(1 - val)/2);}
}
 elsif (m == 4)
{
controls.throttleAxis();
} elsif (m == 5) {
controls.throttleAxis();}</script>
 </binding>
 
<low>  <repeatable type="bool">true</repeatable>
 <binding>
 <command>nasal</command>
 <script>props.setAll("/controls/engines/engine", "boost", 1);setprop("/controls/gear/brake-parking", -1)</script>
 </binding> <repeatable type="bool">false</repeatable> <binding> <command>nasal></command> <script> props.setAll("/controls/engines/engine", "boost", 1);</script> </binding> <mod-up>  <repeatable type="bool">true</repeatable>
 <binding>
 <command>nasal</command>
 <script>props.setAll("/controls/engines/engine", "boost", 0);</script>
 </binding> </mod-up> </low>
<high>
 <repeatable>true</repeatable>
 <binding>
 <command>nasal</command>
 <script>
 m = get_mode();
 if (m == 2) {setprop("/controls/engines/engine[0]/magnetos", 0);} elsif (m == 3) {setprop("/controls/engines/engine[0]/magnetos", 0);}
</script>
 </binding>
 <mod-up>  <repeatable type="bool">true</repeatable>
 <binding>
 <command>nasal</command>
 <script>setprop("/controls/engines/engine[0]/magnetos", 1);controls.applyBrakes(0);setprop("/controls/gear/tailwheel-lock", 1);</script>
 </binding> </mod-up>  </high> </axis>

<axis n="4">
<desc>THROTTLE 2  0145-SetModTHR1       23-Right Engines, X-Shut/Mix/Prop/Boost:reset </desc>
 
<repeatable type="bool">false</repeatable> <binding>
 <command>nasal</command>
 <script>
m = get_mode();
if (m == 0) {
throttle_mode.setIntValue(0);}  elsif (m == 2)
{throttle_mode.setIntValue(2);

var val = cmdarg().getNode("setting").getValue();
       if (throttle_mode.getValue() == 2) {throttle_mode.setIntValue(2);setprop("/controls/engines/engine[1]/throttle",
(1 - val)/2);
       }
} elsif (m == 3) {throttle_mode.setIntValue(3);

var val = cmdarg().getNode("setting").getValue();
       if (throttle_mode.getValue() == 3) {throttle_mode.setIntValue(3);setprop("/controls/engines/engine[1]/throttle",
(1 - val)/2); }
}
 </script>
 </binding>
<low>  <repeatable type="bool">true</repeatable>
 <binding>
 <command>nasal</command>
 <script>props.setAll("/controls/engines/engine", "boost", 1);if (getprop("/position/altitude-agl-ft") > 40)
controls.gearDown(-1);</script>
 </binding> <repeatable type="bool">false</repeatable> <binding> <command>nasal></command> <script> props.setAll("/controls/engines/engine", "boost", 1);</script> </binding> <mod-up>  <repeatable type="bool">true</repeatable>
 <binding>
 <command>nasal</command>
 <script>setprop("/controls/engines/engine[1]/boost", 0);</script>
 </binding> </mod-up> </low>
 
<high>
 <repeatable>true</repeatable>
 <binding>
 <command>nasal</command>
 <script>
 m = get_mode();
 if (m == 2) {setprop("/controls/engines/engine[1]/magnetos", 0);setprop("/controls/engines/engine[1]/rpm", 0);} elsif (m == 3) {setprop("/controls/engines/engine[1]/magnetos", 0);setprop("/controls/engines/engine[1]/rpm", 0);}
</script>
 </binding>
 <mod-up>  <repeatable type="bool">true</repeatable>
 <binding>
 <command>nasal</command>
 <script>setprop("/controls/engines/engine[1]/magnetos", 1);</script>
 </binding> </mod-up>  </high>
 </axis>

<axis n="6">
 <desc>HAT 02-PANVIEW VAR, 13-Aileron Trim, 4-x-offsetVAR 5-X-offsetFAST</desc>
 
 <low>
 <repeatable>true</repeatable>
   <binding>
 <command>nasal</command>
 <script>
 m = get_mode();
 if (m == 0) {view.panViewDir(1-getprop("input/joysticks/js[0]/axis[4]/binding/setting")); } elsif (m == 1)
{controls.aileronTrim(-0.75);} elsif (m == 2) {view.panViewDir(1-getprop("input/joysticks/js[0]/axis[4]/binding/setting"));} elsif (m == 3) {controls.aileronTrim(-0.75);}
 elsif (m == 4) {controls.slewProp("/sim/current-view/x-offset-m", (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))* 10);} elsif (m == 5)
{setprop("/sim/current-view/x-offset-m", -5 + getprop("/sim/current-view/x-offset-m"));}</script>
 </binding> </low>
 
<high>
 <repeatable>true</repeatable>
 <binding>
 <command>nasal</command>
 <script>
 m = get_mode();
 if (m == 0) {view.panViewDir(-(1-getprop("input/joysticks/js[0]/axis[4]/binding/setting")));} elsif (m == 1)
{controls.aileronTrim(0.75); } elsif (m == 2)
{view.panViewDir(-(1-getprop("input/joysticks/js[0]/axis[4]/binding/setting")));} elsif (m == 3)
{controls.aileronTrim(0.75);} elsif (m == 4)
{controls.slewProp("/sim/current-view/x-offset-m", (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))* -10);} elsif (m == 5)
{setprop("/sim/current-view/x-offset-m", 5 + getprop("/sim/current-view/x-offset-m"));}</script>
 </binding> </high> </axis>

<axis n="7"> <desc>HAT 02-VERTVIEW Fas-Slo,  13-Elevator Trim, 4 Y-ax Fas, 5 Y-ax Slo/LandLights 135-FlapsUp</desc>
 <low> <repeatable>true</repeatable> <binding> <command>nasal</command> <script>
 m = get_mode(); if (m == 0) {view.panViewPitch(1-getprop("input/joysticks/js[0]/axis[4]/binding/setting"));}
elsif (m == 1){controls.elevatorTrim(-0.75);} elsif (m == 2)
{view.panViewPitch(1-getprop("input/joysticks/js[0]/axis[4]/binding/setting"));} elsif (m == 3)
{controls.elevatorTrim(-0.75);} elsif (m == 4)
{setprop("/sim/current-view/y-offset-m", getprop("/sim/current-view/y-offset-m") + (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))/10);} elsif (m == 5) {setprop("/sim/current-view/y-offset-m", 5 + getprop("/sim/current-view/y-offset-m"));} </script> </binding> </low>
 
<high> <repeatable>true</repeatable> <binding> <command>nasal</command> <script>
 m = get_mode(); if (m == 0) {view.panViewPitch(-(1-getprop("input/joysticks/js[0]/axis[4]/binding/setting")));}
elsif (m == 1) {controls.elevatorTrim(0.75); } elsif (m == 2)
{view.panViewPitch(-(1-getprop("input/joysticks/js[0]/axis[4]/binding/setting")));} elsif (m == 3)
{controls.elevatorTrim(0.75);} elsif (m == 4)
{setprop("/sim/current-view/y-offset-m", getprop("/sim/current-view/y-offset-m") - (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))/10);} elsif (m == 5)
{setprop("/sim/current-view/y-offset-m", -10 + getprop("/sim/current-view/y-offset-m"));}</script>
 </binding> </high> </axis>

<button n="1">
 <desc>X_leftBrake, 0-spare, 24-PilotView,          135-StartEng, 4-WinchGlider, 5-Spare</desc>
<binding>
 <command>property-assign</command> <property>/controls/gear/brake-left</property> <value type="double">1.0</value> </binding>    <repeatable type="bool">false</repeatable>
 <binding>
 <command>nasal</command>
 <script>

m = get_mode();
if (m == 0) {setprop("/sim/current-view/goal-pitch-offset-deg", 0.0);} elsif (m == 1) {
 controls.startEngine(1);setprop("/sim/model/start-idling",1);setprop("/sim/model/autostart",1); } elsif (m == 2) {setprop("/controls/engines/engine[0]/magnetos", 1);setprop("/controls/engines/engine[0]/starter", 1);} elsif (m == 3) {setprop("/controls/engines/engine[1]/magnetos", 1);setprop("/controls/engines/engine[1]/starter", 1);setprop("/sim/model/start-idling",1);setprop("/sim/model/autostart",1); }
 elsif (m == 4) {


setprop("/controls/winch/place",1);setprop("/sim/hitches/winch/winch/rel-speed",1); }
 elsif (m == 5) {
 controls.startEngine(1);setprop("/sim/model/start-idling",1);setprop("/sim/model/autostart",1); }
if (getprop("/position/altitude-agl-ft") > 40) setprop("/sim/current-view/goal-heading-offset-deg", 90.0);</script>
 </binding>
<mod-up>
 <binding>
   <command>nasal</command>
 <script>
 m = get_mode();
      if (m == 0) {
              #
        } elsif (m == 1) {
      #
        }
elsif (m == 2) {      #
      } elsif (m == 3) {
      #
        }
 elsif (m == 4) {      #
       
}
 elsif (m == 5) {      #
        }
props.setAll("/controls/engines/engine", "starter", 0);</script>
 </binding>
  <binding>
 <command>property-assign</command> <property>/controls/gear/brake-left</property> <value type="double">0.0</value> </binding>

 <binding> <command>property-assign</command> <property>/controls/gear/tailwheel-lock</property> <value type="double">1.0</value> </binding> </mod-up> </button>
 

<button n="2">
<desc> 024-BRAKES,  135-ParkingBrake, 4-ReleaseGlider, FoldWingsDown</desc>
    <binding> <command>nasal</command> <script>m = get_mode();if (m == 0 or m == 2 or m == 4)
{controls.applyBrakes(1);} elsif (m == 1 or m == 3 or m== 5) {i = controls.applyParkingBrake(1);controls.applyBrakes(0);}   setprop("/sim/current-view/view-number","0");
setprop("/sim/current-view/goal-pitch-offset-deg", getprop("/sim/view/config/default-pitch-deg"));
setprop("/sim/current-view/goal-heading-offset-deg", getprop("/sim/view/config/default-heading-deg"));
setprop("/sim/current-view/field-of-view", getprop("/sim/view/config/default-field-of-view-deg"));
setprop("/sim/current-view/x-offset-m", getprop("/sim/view/config/x-offset-m"));
setprop("/sim/current-view/y-offset-m", getprop("/sim/view/config/y-offset-m"));
setprop("/sim/current-view/z-offset-m", getprop("/sim/view/config/z-offset-m"));
</script> </binding>
  <mod-up>  <binding> <command>nasal</command> <script> controls.applyBrakes(0);</script>
</binding> </mod-up>  </button>


<button n="3">
<desc>X_rightBrake</desc>
    <binding>
  <command>property-assign</command> <property>/controls/gear/brake-right</property> <value type="double">1.0</value> </binding>  <repeatable type="bool">false</repeatable>
 <binding>
 <command>nasal</command>
 <script>if (getprop("/position/altitude-agl-ft") > 40) setprop("/sim/current-view/goal-heading-offset-deg", -90.0);
</script> </binding>
<mod-up> <binding> <command>property-assign</command> <property>/controls/gear/brake-right</property> <value type="double">0.0</value> </binding> </mod-up>  </button>



<button n="4"><!--T1-->
   <desc>T1  024-Add_Magneto,5-NoYawView  135-Cut_Magneto,X-Togl/Chute/B1900ELEC-FreeTailWHL</desc>
<repeatable type="bool">false</repeatable> <binding>
   <command>nasal</command>
   <script>
 m = get_mode();
if (m == 0) {
   controls.stepMagnetos(1);setprop("/controls/lighting/landing-lights",1);
  } elsif (m == 1) {
 controls.stepMagnetos(-1); } elsif (m == 2) {
   controls.stepMagnetos(1); } elsif (m == 3) {
 controls.stepMagnetos(-1);setprop("/sim/model/start-idling",0);setprop("/sim/model/autostart",0);
 }
 elsif (m == 4) {
 controls.stepMagnetos(1);
setprop("/controls/lighting/landing-lights",1); }
 elsif (m == 5) {
 controls.stepMagnetos(-1);setprop("/sim/model/start-idling",0);setprop("/sim/model/autostart",0);
 }setprop("controls/gear/tailwheel-lock",0);setprop("/controls/flight/speedbrake", 1);</script>
 </binding>
 <mod-up>
 
 <repeatable type="bool">false</repeatable> <binding>
   <command>nasal</command>
   <script> setprop("controls/gear/tailwheel-lock",1);setprop("/controls/flight/speedbrake", 0);
view.resetView();</script> </binding> </mod-up>
 
</button>

<!--vulcanb2.toggle_chute();-->

<button n="5">   <desc>T2  024-ReverseThrust, X_BRAKES           13-Tailwheel, 5-AirBrake, X-CUT:POWER</desc>
 <binding>
 <command>property-assign</command> <property>/controls/gear/brake-left</property> <value type="double">1.0</value> </binding> <binding> <command>property-assign</command> <property>/controls/gear/brake-right</property> <value type="double">1.0</value> </binding> <repeatable type="bool">false</repeatable>
 <binding>
 <command>nasal</command>
      <script>
props.setAll("/controls/engines/engine", "reverser", 1);setprop("/controls/flight/speedbrake", 1);setprop("/controls/gear/tailwheel-lock", 1);</script>
 </binding> <binding>
 <command>nasal</command>
 <script>
props.setAll("/controls/engines/engine", "throttle", -1);</script> </binding>
 <mod-up>
 <binding>
   <command>nasal</command>
 <script>
props.setAll("/controls/engines/engine", "reverser", 0);setprop("/controls/flight/speedbrake", 0);</script>
 </binding>   <binding> <command>property-assign</command> <property>/controls/gear/brake-left</property> <value type="double">0.0</value> </binding> <binding> <command>property-assign</command> <property>/controls/gear/brake-right</property> <value type="double">0.0</value> </binding> 
</mod-up>
</button>

<button n="6"> <desc>T3  02-FINE_Prop,  13-Rich_Mixture 45 ZOOM</desc>
 <repeatable type="bool">true</repeatable> <binding> <command>nasal</command>
 <script> m = get_mode(); if (m == 0)
{controls.adjPropeller(1);} elsif (m == 1) {controls.adjMixture(1);controls.adjCondition(1);} elsif (m == 2)
{controls.adjPropeller(1);} elsif (m == 3) {controls.adjMixture(1);controls.adjCondition(1);} elsif (m == 4)
{ controls.slewProp("/sim/current-view/field-of-view",
getprop("input/joysticks/js[0]/axis[4]/binding/setting") * 10); } elsif (m == 5)
{setprop("/sim/current-view/field-of-view", -1 + getprop("/sim/current-view/field-of-view"));}
<![CDATA[ if (getprop("/sim/current-view/field-of-view") >= 150)
 setprop("/sim/current-view/field-of-view", 150);if (getprop("/sim/current-view/field-of-view") <= 0.1)
 setprop("/sim/current-view/field-of-view", 0.1); ]]> </script> </binding> </button>

<button n="7"> <desc>T4  02-Course_Prop,  13-Rich_Mixture 45 ZOOM</desc>
 <repeatable type="bool">true</repeatable> <binding> <command>nasal</command>
 <script>m = get_mode();if (m == 0) {controls.adjPropeller(-1);} elsif (m == 1)
{controls.adjMixture(-1);controls.adjCondition(-1);} elsif (m == 2)
{controls.adjPropeller(-1);} elsif (m == 3)
{controls.adjCondition(-1);controls.adjMixture(-1);} elsif (m == 4)
{controls.slewProp("/sim/current-view/field-of-view",
 -(1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting")) * -20);} elsif (m == 5)
{setprop("/sim/current-view/field-of-view", 1 + getprop("/sim/current-view/field-of-view"));}
<![CDATA[ if (getprop("/sim/current-view/field-of-view") >= 150)
            setprop("/sim/current-view/field-of-view", 150); ]]> </script> </binding>  </button>

<button n="8"> <desc>T5  024-Flaps_Up, X_lockTailwheel,          135-Gear_Up, Zero_Trim</desc>
 <repeatable type="bool">false</repeatable>
    <binding>
 <command>nasal</command>
 <script>
   m = get_mode();
   if (m == 0) {
 controls.flapsDown(-1);controls.stepSpoilers(-1)
 } elsif (m == 1) {controls.gearDown(-1);} elsif (m == 2) {
 controls.flapsDown(-1);
controls.stepSpoilers(-1);
props.setAll("/controls/engines/engine", "reverser", 1);setprop("/sim/model/pushback/target-speed-fps", -25 ); } elsif (m == 3) {
 if (getprop("/position/altitude-agl-ft") > 40)
controls.gearDown(-1);}
 elsif (m == 4) {
 controls.flapsDown(-1);
controls.stepSpoilers(-1); } elsif (m == 5) {if (getprop("/position/altitude-agl-ft") > 40)
controls.gearDown(-1);}#if (getprop("/position/altitude-agl-ft") > 400) setprop("/sim/current-view/goal-pitch-offset-deg", 90.0);
 </script>
   </binding>
                       

<mod-up>
 <binding>
 <command>nasal</command>
 <script>
 m = get_mode();
 if (m == 0) {
 controls.flapsDown(0);
 } elsif (m == 1) {
 controls.gearDown(0);
 } elsif (m == 2) {
 controls.flapsDown(0); } elsif (m == 3) {
       controls.gearDown(0);      }
 elsif (m == 4) {
 controls.flapsDown(0);
 } elsif (m == 5) {
 controls.gearDown(0);
 }
setprop("/controls/gear/tailwheel-lock", 1);</script>
 </binding>
   </mod-up>
 </button>

                                                         
<button n="9"><!-- T6 -->
<desc>T6  024-Flaps_Dn,  X_ZeroRA,lockTW          135-Gear_Down, 5-Seafire/Spitfire H</desc>
 <repeatable type="bool">false</repeatable>
 <binding>
 <command>nasal</command>
 <script>
 m = get_mode();
if (m == 0) {
 controls.flapsDown(1);
controls.stepSpoilers(1)      } elsif (m == 1) {
 controls.gearDown(1); } elsif (m == 2) {
 controls.flapsDown(1);
controls.stepSpoilers(1)
 } elsif (m == 3) {
 controls.gearDown(1);}
 elsif (m == 4) {
 controls.flapsDown(1);
controls.stepSpoilers(1)
 } elsif (m == 5) {

 controls.gearDown(1);

spitfire.openDoor(0);
spitfire.openCanopy(0);
 }
setprop("/controls/gear/tailwheel-lock",1);</script>
 </binding>
 <mod-up>
 <binding>
   <command>nasal</command>
 <script>
 m = get_mode();
 if (m == 0) {
 controls.flapsDown(0);
        } elsif (m == 1) {
 controls.gearDown(0); } elsif (m == 2) {
 controls.flapsDown(0);
 } elsif (m == 3) {
controls.gearDown(0); }
 elsif (m == 4) {
 controls.flapsDown(0);    } elsif (m == 5) {
controls.gearDown(0);}</script>
 </binding>
 </mod-up>
 </button>

<button n="8">
  <desc>Decrease flaps</desc>
  <binding>
   <command>nasal</command>
   <script>controls.flapsDown(-1)</script>
  </binding>
  <mod-up>
   <binding>
    <command>nasal</command>
    <script>controls.flapsDown(0)</script>
   </binding>
  </mod-up>
 </button>

 <button n="9">
  <desc>Increase flaps</desc>
  <binding>
   <command>nasal</command>
   <script>controls.flapsDown(1)</script>
  </binding>
  <mod-up>
   <binding>
    <command>nasal</command>
    <script>controls.flapsDown(0)</script>
   </binding>
  </mod-up>
 </button>-->


<button n="10"> <desc>T7 ViewFORE</desc>
  <repeatable>true</repeatable>
 <binding>
 <command>nasal</command>
 <script>
 m = get_mode();
 if (m == 0) {controls.slewProp("/sim/current-view/z-offset-m", (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))* -10);} elsif (m == 1) {controls.slewProp("/sim/current-view/z-offset-m", (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))* -100);} elsif (m == 2) {controls.slewProp("/sim/current-view/z-offset-m", (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))* -10);} elsif (m == 3) {setprop("/sim/current-view/z-offset-m", getprop("/sim/view/config/z-offset-m"));}
 elsif (m == 4) {controls.slewProp("/sim/current-view/z-offset-m", (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))* -10);} elsif (m == 5) {controls.slewProp("/sim/current-view/z-offset-m", -100);}
</script> </binding> </button>

<button n="11"> <desc>T8  VIEWBACK</desc>
  <repeatable>true</repeatable>
 <binding>
 <command>nasal</command>
 <script>
 m = get_mode();
 if (m == 0) {controls.slewProp("/sim/current-view/z-offset-m", (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))* 10);} elsif (m == 1) {controls.slewProp("/sim/current-view/z-offset-m", (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))* 100);} elsif (m == 2) {controls.slewProp("/sim/current-view/z-offset-m", (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))* 10);} elsif (m == 3) {setprop("/sim/current-view/z-offset-m", getprop("/sim/view/config/z-offset-m"));}
 elsif (m == 4) {controls.slewProp("/sim/current-view/z-offset-m", (1 - getprop("input/joysticks/js[0]/axis[4]/binding/setting"))* 10);} elsif (m == 5) {controls.slewProp("/sim/current-view/z-offset-m", 100);}
 </script> </binding> </button>


<button n="0"> <desc>Trigger is Modifier Bit 0 and StarterRegulator          info: X = every time button is pressed</desc>
 <repeatable type="bool">false</repeatable>
 <binding>
      <command>nasal</command>
 <script>
m = modifier.getValue();
if (m == 0 or m == 2 or m == 4) {
modifier.setIntValue(m + 1);props.setAll("/controls/engines/engine", "starter", 0);
}
</script>
 </binding>
 <mod-up>
 <binding>
   <command>nasal</command>
   <script>
m = modifier.getValue();
if (m == 1 or m == 3 or m == 5) {
 modifier.setIntValue(m - 1);props.setAll("/controls/engines/engine", "starter", 0); }
</script>
 </binding>
 </mod-up>
 </button>



<button n="12"><!--switch mode A modifier-->
 <desc>Mode A Switch is Modifier Bit 1        Silence B1900 Annoying Nav Signal T3 0-Off 1-On</desc>
      <repeatable type="bool">false</repeatable>
 <binding>
 <command>nasal</command>
         <script>
m = modifier.getValue();
if (m == 0 or m == 1) {
   modifier.setIntValue(m + 2);
 }
</script>
      </binding>
 <mod-up>
 <binding>
 <command>nasal</command>
 <script>
m = modifier.getValue();
if (m == 2 or m == 3) {
 modifier.setIntValue(m - 2);
 }
</script>
 </binding>
 </mod-up>
  </button>



 <button n="13"><!--switch mode B modifier-->
 <desc>Mode B Switch is Modifier Bit 2        H = PreFlight check canopy, hatches, doors closed</desc>
      <repeatable type="bool">false</repeatable>
 <binding>
 <command>nasal</command>
         <script>
m = modifier.getValue();
if (m == 0 or m == 1) {
   modifier.setIntValue(m + 4);
 }
</script>
      </binding>
 <mod-up>
 <binding>
 <command>nasal</command>
 <script>
m = modifier.getValue();
if (m == 4 or m == 5) {
 modifier.setIntValue(m - 2);
 }
</script>
 </binding>
 </mod-up>
 </button> </PropertyList>
User avatar
sim
 
Posts: 1431
Joined: Tue Jun 30, 2009 3:13 pm
Location: Shropshire England
Callsign: Fly4Fun
Version: 0.9.10 up
OS: 64 Win 10 HD6450

Previous

Return to Hardware

Who is online

Users browsing this forum: No registered users and 3 guests