HELICOPTER event trim set

Hello,
I’m trying to set the ROTOR_LONGITUDINAL_TRIM_SET variable or the ROTOR_LATERAL_TRIM_SET variable.

According to the documentation, it should be between +/-16384

If I enter a positive value in my program, it returns the correct value between 0 and 1 controlled via the variable ROTOR LONGITUDINAL TRIM PCT or ROTOR LATERAL TRIM PCT, but if I enter a negative value, the variable ROTOR LONGITUDINAL TRIM PCT or ROTOR LATERAL TRIM PCT returns 1, so I can’t get a negative value.
I don’t know if I’m doing something wrong or if it’s a bug

ROTOR_LATERAL_TRIM_SET and ROTOR_LATERAL_TRIM_SET are Event variables (KVars) .

If you are using SimConnect to set an Event variable with ’ SimConnect_TransmitClientEvent’, the third parameter - ie ‘dwData’ - is defined as a DWORD (which is normally a signed Integer). However, for KVars that parameter must always be set as an Unsigned Integer (no negative numbers) .

To set a negative value you will need to convert the value you want to set to the Unsigned Integer representation of the negative number.

Check out this reference: “MSFS - Managed SimConnect Library doesn't take negative values using VB .NET 2019 and TransmitClientEvent() | FSDeveloper” for an example of how to do that if you aren’t sure.

So as examples - to set ‘-1’ as a value the converted value is 4294967295
while ‘-16384’ converts to 4295950912

It’s not really a bug per se - more an unclear and incomplete description in the documentation.

Thank you for your answer, it could have been the right way but unfortunately it’s not.
I didn’t specify that my program was in JS.

To test, use coherent Gt debugger:
And in the console type : SimVar.SetSimVarValue('K:ROTOR_LONGITUDINAL_TRIM_SET', 'position', x );
or x = the value you wish to use.

Whatever the value, you’ll see that the helicopter tilts to the tail.

By the way, the AXIS_CYCLIC_LONGITUDINAL_SET variable in the doc uses the same parameters, and it works.

https://docs.flightsimulator.com/flighting/html/Programming_Tools/Event_IDs/Helicopter_Specific_Events.htm

OK. Well sorry I couldn’t help you directly but I hope what I said will help anyone using managed code (VB.NET or C#) to set a KVar value via SimConnect. It certainly works for me.

Hello @DeelLav

I logged a bug for these 2 key events as they do not allow negative values.
There is no workaround unfortunately.

Regards,
Sylvain