(Fade in Chorus of Valkyries and/or angelic chants in the background...)
Need to trim-hold your sim helo with the push of a button? Does your sim either not have that or have wings-leveling AFCS switched On all the time? This might be your solution! Think of DCS Blackshark, Enemy Engaged, or (apparently) the original Search & Rescue.
Some older sims do not seem capable of recognizing Windows' preferred joystick designation. So not every sim will work with this. Something like Longbow 2 or Gunship! already has Dynamic Trimming or Attitude Hold/ Attitude Command designed into it. This is for anything else, including civilian helo sims.
X-Plane has the option of auto trimming of pitch loads, which can be switched on in Planemaker, but that can be somewhat slow to respond in V9 and V10. It does work, though, and that's how I have Comanche and Apache models on X-Plane.org set up. That check box can be easily turned off and I'm sure the first script will work perfectly in it, as well as in FightGear, and other sims. (Edit: Yep.)
These scripts are pre-set for the X65F and rudder pedals that I have with me currently, but can be easily changed for anything else with Find/Replace after you've made up your PPJoy virtual joystick and know its axis identities. I just tested it in MS FS9/2004. Works great. I also have one with trimming for the x-axis too. For Comanche Gold that works well for when I want manual trimming. You can do it for the yaw, though I haven't found much use for that. I have my top rotary mixed in as yaw trim.
There are several different methods I used for preventing bumps in control input between when you release that trimmer and when joystick input is "added" to the held trim state, and this final way with multiplying the var.y and joystick.y worked the best without needing another variable to track signs. Just waiting until you moved the stick near zero didn't always work, as you could pitch forward, trim, and pull back while GlovePIE never actually registered the near-zero axis value. So this works for Y always, and also for X on the next script. I tried using just negative signs, but while that worked for Y-forward, it didn't work for Y-back (no biggy), and only worked for one side of X (that's bad).
It's lovely now and everything I wanted it to be short of actually telling the given sim's AFCS wings-leveling to do all the work for me to hold that specific new attitude (i.e. it takes time for the attitude to settle). Give it a try. I'm quite proud of the results.
In case any of you haven't read the other posts I mentioned it on, I found a way to get crude Vortex Ring Stall, as well. I will include my latest most complicated Comanche Gold script (the third one) that includes that and other attempts to make the flight model more conventional and give my pedals (and me) more of a difficult task flying. It gives you a massive appreciation for new helo AFCS in freeing up the pilot to actually strategize and fight the OPFOR instead of fighting the helo constantly. And, I suppose, an appreciation of 2-seaters, too.
I will eventually attempt to integrate this manual trimming by button scripting on the first two scripts here into the last script's manual/(really just WL now) Mode 1 (when the mode selection axis is all the way back on my HOTAS). On my Y-rotary (used to have it as the slider on the X52) Middle is Trim Update in full. Forward on that rotary on my HOTAS is the Comanche cruise mode, which I did have on the twist but moved it to the pedals entirely for the heck of it. WL in the X (the default(; auto trimming in the Y. I'm thinking of putting raw yaw on the pedals and putting the highly-correlated turn back on the twist due to collective changing yaw here.
Again, you can assign the axiis to whatever you want. In case you're wondering about the rudder axis zero thing in there: it's a fix I made for dealing with GlovePIE's issue with the Saitek rudder pedals where full left registers as zero, which is seen by most sims as center. That's bad. Their actual center is never zero unless you set it by variable (that's good, because it offers a quick solution), so I just override it.
You must use the newest version of PPjoy if you're in Windows Vista and 7.
http://ppjoy.blogspot.com/You can get GlovePIE at this link below or download the older version that I use in my old X52 pack way down below. When I get some more X65 profiles done I will probably upload one for that HOTAS, too. I only use the newest GlovePIE version for certain things related to XBox controllers. Comanche Gold with an Xbox controller while wearing a 40LB weight vest and walking up hill on a treadmill was hard work, let me tell you. Hmm... a standing desk is in my future, me thinks. Both versions should work with these scripts the same, though.
http://glovepie.org/glovepie.php --------------------------------------------------------------------
//Y-only manual helo trimmer (X65F and pedals)
if joystick2.button4 then {
var.x = 0
var.y = 0
var.lag = 0
}
if released(joystick2.button4) then {
var.y = Joystick2.y
var.lag = 1
}
var.check = joystick2.x * var.x // informational
if (var.lag = 1) and ((Joystick2.y * var.y > .001)) then {
PPJoy1.Analog1 = var.y
} else var.lag = 0
if var.lag = 0 then {
PPJoy1.Analog0 = Joystick2.x
PPJoy1.Analog1 = var.y + Joystick2.y
}
PPJoy1.Analog2 = Joystick2.z
PPJoy1.Analog3 = Joystick2.xrot //side
PPJoy1.Analog4 = Joystick2.yrot //top
if Joystick1.zrot = 0 then {
PPJoy1.Analog5 = -1
else
PPJoy1.Analog5= Joystick1.zrot - Joystick2.xrot// pedals
}
PPJoy1.Analog6 = Joystick2.slider
var.0 = Joystick2.x //below this is informational or for button translation when keys must be in PPJoy
var.1 = Joystick2.y
var.2 = Joystick2.z
var.3 = Joystick2.xrot
var.4 = Joystick2.yrot
var.5 = Joystick1.zrot
var.6 = Joystick2.slider
var.trim = joystick2.Button4
var.p0 = PPJoy1.Analog0
var.p1 = PPJoy1.Analog1
var.p2 = PPJoy1.Analog2
var.p3 = PPJoy1.Analog3
var.p4 = PPJoy1.Analog4
var.p5 = PPJoy1.Analog5
var.p6 = PPJoy1.Analog6
PPJoy1.Digital0 = Joystick2.Button1
PPJoy1.Digital1 = Joystick2.Button2
PPJoy1.Digital2 = Joystick2.Button3
PPJoy1.Digital3 = Joystick2.Button4
PPJoy1.Digital4 = Joystick2.Button5
PPJoy1.Digital5 = Joystick2.Button6
PPJoy1.Digital6 = Joystick2.Button7
PPJoy1.Digital7 = Joystick2.Button8
PPJoy1.Digital8 = Joystick2.Button9
PPJoy1.Digital9 = Joystick2.Button10
PPJoy1.Digital10 = Joystick2.Button11
PPJoy1.Digital11 = Joystick2.Button12
PPJoy1.Digital12 = Joystick2.Button13
PPJoy1.Digital13 = Joystick2.Button14
PPJoy1.Digital14 = Joystick2.Button15
PPJoy1.Digital15 = Joystick2.Button16
PPJoy1.Digital16 = Joystick2.Button17
PPJoy1.Digital17 = Joystick2.Button18
PPJoy1.Digital18 = Joystick2.Button19
PPJoy1.Digital19 = Joystick2.Button20
PPJoy1.Digital20 = Joystick2.Button21
PPJoy1.Digital21 = Joystick2.Button22
PPJoy1.Digital22 = Joystick2.Button23
PPJoy1.Digital23 = Joystick2.Button24
PPJoy1.Digital24 = Joystick2.Button25
PPJoy1.Digital25 = Joystick2.Button26
PPJoy1.Digital26 = Joystick2.Button27
PPJoy1.Digital27 = Joystick2.Button28
PPJoy1.Digital28 = Joystick2.Button29
PPJoy1.Digital29 = Joystick2.Button30
PPJoy1.Digital30 = Joystick2.Button31
// end of script
--------------------------------------------------
//X and Y manual helo trimmer (X65F and pedals)
if joystick2.button4 then {
var.x = 0
var.y = 0
var.lag = 0
}
if released(joystick2.button4) then {
var.x = Joystick2.x
var.y = Joystick2.y
var.lag = 1
}
var.check = joystick2.x * var.x // informational
if (var.lag = 1) and ((Joystick2.x * var.x > .001) or (Joystick2.y * var.y > .001)) then {
PPjoy1.Analog0 = var.x
PPJoy1.Analog1 = var.y
} else var.lag = 0
if var.lag = 0 then {
PPJoy1.Analog0 = var.x + Joystick2.x
PPJoy1.Analog1 = var.y + Joystick2.y
}
PPJoy1.Analog2 = Joystick2.z
PPJoy1.Analog3 = Joystick2.xrot //side
PPJoy1.Analog4 = Joystick2.yrot //top
if Joystick1.zrot = 0 then {
PPJoy1.Analog5 = -1
else
PPJoy1.Analog5= Joystick1.zrot - Joystick2.xrot// pedals
}
PPJoy1.Analog6 = Joystick2.slider
var.0 = Joystick2.x //below this is informational or for button translation when keys must be in PPJoy
var.1 = Joystick2.y
var.2 = Joystick2.z
var.3 = Joystick2.xrot
var.4 = Joystick2.yrot
var.5 = Joystick1.zrot
var.6 = Joystick2.slider
var.trim = joystick2.Button4
var.p0 = PPJoy1.Analog0
var.p1 = PPJoy1.Analog1
var.p2 = PPJoy1.Analog2
var.p3 = PPJoy1.Analog3
var.p4 = PPJoy1.Analog4
var.p5 = PPJoy1.Analog5
var.p6 = PPJoy1.Analog6
PPJoy1.Digital0 = Joystick2.Button1
PPJoy1.Digital1 = Joystick2.Button2
PPJoy1.Digital2 = Joystick2.Button3
PPJoy1.Digital3 = Joystick2.Button4
PPJoy1.Digital4 = Joystick2.Button5
PPJoy1.Digital5 = Joystick2.Button6
PPJoy1.Digital6 = Joystick2.Button7
PPJoy1.Digital7 = Joystick2.Button8
PPJoy1.Digital8 = Joystick2.Button9
PPJoy1.Digital9 = Joystick2.Button10
PPJoy1.Digital10 = Joystick2.Button11
PPJoy1.Digital11 = Joystick2.Button12
PPJoy1.Digital12 = Joystick2.Button13
PPJoy1.Digital13 = Joystick2.Button14
PPJoy1.Digital14 = Joystick2.Button15
PPJoy1.Digital15 = Joystick2.Button16
PPJoy1.Digital16 = Joystick2.Button17
PPJoy1.Digital17 = Joystick2.Button18
PPJoy1.Digital18 = Joystick2.Button19
PPJoy1.Digital19 = Joystick2.Button20
PPJoy1.Digital20 = Joystick2.Button21
PPJoy1.Digital21 = Joystick2.Button22
PPJoy1.Digital22 = Joystick2.Button23
PPJoy1.Digital23 = Joystick2.Button24
PPJoy1.Digital24 = Joystick2.Button25
PPJoy1.Digital25 = Joystick2.Button26
PPJoy1.Digital26 = Joystick2.Button27
PPJoy1.Digital27 = Joystick2.Button28
PPJoy1.Digital28 = Joystick2.Button29
PPJoy1.Digital29 = Joystick2.Button30
PPJoy1.Digital30 = Joystick2.Button31
// end of script
--------------------------------------------------------------------------------
// Comanche Gold Three Flight Laws - Manual/WL, AH/AC, and Cruise Modes. Nonlinear. Adverse Dutch. Hard, non-Crosscoupled Conventional Yaw. Pedals. Vortex. Stabilized. (X65F and pedals)
PPJoy1.Analog2 = joystick2.z + (var.pedalfix/5)
var.znegchange = Smooth(PPJoy1.Analog2, 20) - PPJoy1.Analog2
var.lateral = (PPJoy.Analog0^2/5) + (PPjoy.Analog1^2/2)
if var.vortex = 0 and var.znegchange > 0.25 and var.lateral < 0.01 then var.vortex = 1
if ((var.vortex = 1 and var.lateral < .175) or (var.vortex = 1 and smooth(joystick2.z, 20) > -0.95 )) then {
var.znegchange = Smooth(PPJoy1.Analog2, 20) - PPJoy1.Analog2
var.lateral = (PPJoy.Analog0^2/5) + (PPjoy.Analog1^2/2)
//PPJoy1.Analog2 = joystick2.z + (var.pedalfix/5) - var.znegchange + var.lateral
PPJoy1.Analog2 = -1
}
if ((var.vortex = 1 and var.lateral > .2) or (var.vortex = 1 and smooth(joystick2.z, 20) < -0.95)) then {
var.vortex = 0
var.znegchange = Smooth(PPJoy1.Analog2, 20) - PPJoy1.Analog2
var.lateral = (PPJoy.Analog0^2/5) + (PPjoy.Analog1^2/2)
PPJoy1.Analog2 = joystick2.z + (var.pedalfix/5)
}
if joystick1.zrot = 0 then {
var.pedalfix = -1
else
var.pedalfix = joystick1.zrot
}
PPJoy1.Analog3 = joystick2.xrot
PPJoy1.Analog4 = joystick2.yrot
PPJoy1.Analog6 = joystick2.yrot
var.nlxs = sign(joystick2.x)
var.nlxm = abs(joystick2.x)^(1.3)
var.nlx = var.nlxm * var.nlxs
var.nlys = sign(joystick2.y)
var.nlym = abs(joystick2.y)^(1.3)
var.nly = var.nlym * var.nlys
var.nlzrots = sign(var.pedalfix)
var.nlzrotm = abs(var.pedalfix)^(1.3)
var.nlzrot = var.nlzrotm * var.nlzrots
if HeldDown(Keyboard.Equals,0) then begin { // Popup by Zero Key, Currently Not Assigned, Relic of less complicated scripts
var.p = var.p-.03
} else if Release(Keyboard.Equals)then begin {
var.p = EnsureRange(abs(var.p)-.03, 0, 100)
} end
var.t = (var.nly - Smooth(var.y, 1200))/5
var.q = EnsureRange(var.p, -1, 1)
var.r = (joystick2.z - var.q)
var.c = (EnsureRange(var.r, -1, 1) * (1 - abs(Smooth(var.y, 1200))) + .2)
if -.75 < joystick2.yrot < .75 then begin {
var.y = EnsureRange(var.nly / 25 + var.y, -1, 1)
PPJoy1.Analog1 = var.y + var.nly
var.x = EnsureRange(var.nlx / 25 + var.x, -1, 1)
PPJoy1.Analog0 = var.x + var.nlx + (var.t*2) + (-Joystick2.xrot/8)
if (abs(var.x) = 1) and (abs(var.nlx) > .0001) then BeepDefault
if (abs(var.y) = 1) and (abs(var.nly) > .0001) then BeepDefault
PPJoy1.Analog5 = var.nlzrot + ((var.c - var.t) * (0.70 - var.lateral))
} else if joystick2.yrot > .75 then begin {
var.x = var.nlx
var.y = EnsureRange(var.nly / 25 + var.y, -1, 1)
PPJoy1.Analog1 = var.y + var.nly
if (abs(var.y) = 1) and (abs(var.nly) > .0001) then BeepDefault
PPJoy1.Analog5 = var.nlzrot + (var.nlx * Smooth(var.y, 1200)) + ((var.c - var.t) * (0.70 - var.lateral))
PPJoy1.Analog0 = var.nlzrot + var.nlx + (var.t*2) + (-Joystick2.xrot/8)
} else begin {
var.y = var.nly
var.x = var.nlx
PPJoy1.Analog1 = var.y
PPJoy1.Analog0 = var.x + var.t + (-Joystick2.xrot/8)
PPJoy1.Analog5 = var.nlzrot + ((var.c - var.t) * (0.70 - var.lateral))
} end
var.0= var.nlx //below this is informational or for button translation when keys must be in PPJoy
var.1= var.nly
var.2= joystick2.z
var.3= joystick2.xrot
var.4= joystick2.yrot
var.5= var.nlzrot
var.6= joystick2.yrot
var.p0 = PPJoy1.Analog0
var.p1 = PPJoy1.Analog1
var.p2 = PPJoy1.Analog2
var.p3 = PPJoy1.Analog3
var.p4 = PPJoy1.Analog4
var.p5 = PPJoy1.Analog5
var.p6 = PPJoy1.Analog6
PPJoy1.Digital0 = Joystick2.Button1
PPJoy1.Digital1 = Joystick2.Button2
PPJoy1.Digital2 = Joystick2.Button3
PPJoy1.Digital3 = Joystick2.Button4
PPJoy1.Digital4 = Joystick2.Button5
PPJoy1.Digital5 = Joystick2.Button6
PPJoy1.Digital6 = Joystick2.Button7
PPJoy1.Digital7 = Joystick2.Button8
PPJoy1.Digital8 = Joystick2.Button9
PPJoy1.Digital9 = Joystick2.Button10
PPJoy1.Digital10 = Joystick2.Button11
PPJoy1.Digital11 = Joystick2.Button12
PPJoy1.Digital12 = Joystick2.Button13
PPJoy1.Digital13 = Joystick2.Button14
PPJoy1.Digital14 = Joystick2.Button15
PPJoy1.Digital15 = Joystick2.Button16
PPJoy1.Digital16 = Joystick2.Button17
PPJoy1.Digital17 = Joystick2.Button18
PPJoy1.Digital18 = Joystick2.Button19
PPJoy1.Digital19 = Joystick2.Button20
PPJoy1.Digital20 = Joystick2.Button21
PPJoy1.Digital21 = Joystick2.Button22
PPJoy1.Digital22 = Joystick2.Button23
PPJoy1.Digital23 = Joystick2.Button24
PPJoy1.Digital24 = Joystick2.Button25
PPJoy1.Digital25 = Joystick2.Button26
PPJoy1.Digital26 = Joystick2.Button27
PPJoy1.Digital27 = Joystick2.Button28
PPJoy1.Digital28 = Joystick2.Button29
PPJoy1.Digital29 = Joystick2.Button30
PPJoy1.Digital30 = Joystick2.Button31
// end of script