Writing Joystick Code: Part 2: Difference between revisions

no edit summary
m (WIP template)
No edit summary
Line 100: Line 100:
   interpolate("/controls/flight/aileron-trim", getprop("controls/flight/aileron-trim"), 0)
   interpolate("/controls/flight/aileron-trim", getprop("controls/flight/aileron-trim"), 0)
   
   
To make it go faster, make the 30 smaller.
To make it go faster, make the 30 smaller.
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
  If you want rudder-trim, use either the repeatable or non-repeatable above, changing elevator/aileron to rudder
  If you want rudder-trim, use either the repeatable or non-repeatable above, changing elevator/aileron to rudder
Line 147: Line 147:
  U
  U
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
  start engine
  Start all engine all R
-----------------------------------------------------------------------------
  controls.startEngine(1)
  perIndexAxisHandler
  U
  controls.startEngine(0)
Start specific engine R
  controls.startEngine(1, x)
U
  controls.startEngine(0, x)
x is the engine number. First engine is 0.
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
  wingsweep
  wingsweep
Line 155: Line 163:
  weapons
  weapons
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
  ptt
  Toggle all lights on/off NR
  controls.toggleLights()
U
Switch specific lights on NR
  setProp(("controls/lighting/xxx"), true)
U
Switch specific lights off NR
  setProp(("controls/lighting/xxx"), false)
Where xxx = beacon, landing-lights, landing-light, landing-light[1] logo-lights, nav-lights, strobe, taxi-light, taxi-lights, cabin-lights, map-lights.
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
  lights; individual and all
  Instrument lights level up R
  <![CDATA[
    if(getprop("controls/lighting/instruments-norm") < 1 ) {
      setprop("controls/lighting/instruments-norm", getprop ("controls/lighting/instruments-norm") + 0.05)
    }
  ]]>
U
Instrument lights level down R
  <![CDATA[
    if(getprop("controls/lighting/instruments-norm") > 0 ) {
      setprop("controls/lighting/instruments-norm", getprop ("controls/lighting/instruments-norm") - 0.05)
    }
  ]]>
U
Instrument lights level up NR
  <![CDATA[
    if(getprop("controls/lighting/instruments-norm") < 1 ) {
      setprop("controls/lighting/instruments-norm", getprop ("controls/lighting/instruments-norm") + 0.2)
    }
  ]]>
U
Instrument lights level down NR
  <![CDATA[
    if(getprop("controls/lighting/instruments-norm") > 0 ) {
      setprop("controls/lighting/instruments-norm", getprop ("controls/lighting/instruments-norm") - 0.2)
    }
  ]]>
U
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
  step magnetos
  Step magnetos up NR
  controls.stepMagnetos(1)
U
Step magnetos down NR
  controls.stepMagnetos(-1)
U
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------


224

edits