Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Update vjoy axis

Featured Replies

Hi,

I'm trying to synchronize a vJoy axis with the elevator trim in the sim, but I couldn't figure out how to pass the value in the vjax command.

I have a script called GET_TRIM which returns the current trim setting from the sim normalized between 0 and 32767 so I can pass into vjax.

(A:ELEVATOR·TRIM·PCT,·Percent·Over·100)·1·+·16383.5·*·near

My problem is with vjax, I just couldn't figure out how to pass this into it. I tried

(VJAX:1|X|(>K:Scripts-GET_TRIM))

(A:ELEVATOR·TRIM·PCT,·Percent·Over·100)·1·+·16383.5·*·near l0
(VJAX:1|X|sp0)

(A:ELEVATOR·TRIM·PCT,·Percent·Over·100)·1·+·16383.5·*·near·(>L:Scripts-TEMP-TRIM)
(VJAX:1|X|@Scripts-TEMP-TRIM)

and more but these does not work. Can you help me? This RPN is really strange and new for me.

  • Author

I should've posted this question 3 days ago because of course after I posted this I was able to update the vJox axis with this

(A:ELEVATOR·TRIM·PCT,·Percent·Over·100)·1·+·16383.5·*·near·(VJAX:1|X|%1)

Part of my question still holds; how can I call a separate file for its return value? I want to separate the calculation and the vjax call, something like this

--GET_TRIM--
(A:ELEVATOR·TRIM·PCT,·Percent·Over·100)·1·+·16383.5·*·near·(VJAX:1|X|%1)

--SET_AXIS--
(>K:Scripts-GET_TRIM) (VJAX:1|X|%1)

 

  • Author

Also when I try to translate the axis with

(A:ELEVATOR·TRIM·PCT,·Percent·Over·100)·1·+·16383.5·*·near·1000·+·(VJAX:1|X|%1)

it works perfectly when the ELEVATOR TRIM PCT is between -1 and 0 but not when it is between 0 and 1, can you help me understand why?

  • Commercial Member
1 hour ago, racerzeroone said:

Part of my question still holds; how can I call a separate file for its return value? I want to separate the calculation and the vjax call, something like this

There is a way, but for a simple script like this I would recommend using just the one that does both. Jumping to yet another script will just lose you time (at least 100ms)

Edited by Lorby_SI

LORBY-SI

  • Commercial Member
31 minutes ago, racerzeroone said:

Also when I try to translate the axis with

(A:ELEVATOR·TRIM·PCT,·Percent·Over·100)·1·+·16383.5·*·near·1000·+·(VJAX:1|X|%1)

it works perfectly when the ELEVATOR TRIM PCT is between -1 and 0 but not when it is between 0 and 1, can you help me understand why?

I've just tested this exact script, configured as an Aircraft Automated Script, repeating every 100ms. Works fine for me, both ways (trim value above and below 0). I get full travel on the vJoy axis.

Tested with P3D V5, default Maule.

Edited by Lorby_SI

LORBY-SI

  • Author
5 hours ago, Lorby_SI said:

There is a way, but for a simple script like this I would recommend using just the one that does both. Jumping to yet another script will just lose you time (at least 100ms)

Oh I see, then I'll just copy paste it where I need it.

4 hours ago, Lorby_SI said:

I've just tested this exact script, configured as an Aircraft Automated Script, repeating every 100ms. Works fine for me, both ways (trim value above and below 0). I get full travel on the vJoy axis.

Tested with P3D V5, default Maule.

Huh strange, then there is something wrong with MSFS it seems, because when it gets in the positive range it is stuck at full trim.

Thanks for the help!

  • Author

Is there any way to get vJoy axis value? It might be easier to calculate from that instead of ELEVATOR TRIM PCT.

  • Commercial Member
18 hours ago, racerzeroone said:

Is there any way to get vJoy axis value?

No, there isn't.

But I don't understand, what is the goal here, what is your use case?

That the elevator trim variable is behaving strangely might be aircraft dependent. In MSFS you can't rely on the default events or variables, every aircraft developer does things differently.

I've just tested your script with the MSFS Asobo C152 - works fine for me, both positive and negative range I get full travel on the vJoy axis.

Edited by Lorby_SI

LORBY-SI

  • Author

I have a VKB Gladiator NXT joystick which I set up so when I turn the encoder it acts like an axis; turning it up or down translates the axis up and down. I also set up the hat switch to translate this axis with a faster rate, so I can set the trim fast and precisely at the same time.
I use this method as it seems to be more responsive and accurate than using the assigned trim up and down buttons.

My problem with this is the axis can be desynchronized with the in-game trim setting after using the autopilot, which is why I want to use a virtual axis to set the trim, so I can synchronize periodically (this interferes with the sim due to latency) or when disengaging the autopilot.
My other problem is that I recently bought a Honeycomb Bravo which also has a (encoder) trim wheel I want to use to translate the same axis.

So I had an idea of

  • setting up a vJoy device with one axis,
  • setting that axis to be the Elevator Trim Axis (in the sim),
  • using AAO to move this vJoy axis to the sim's trim settings (eg. vJoyAxis = ElevatorTrimPosition),
  • and to translate this axis when using my encoders and HAT switch (eg. vJoyAxis = vJoyAxis + 1000).
  • Commercial Member
21 minutes ago, racerzeroone said:

I have a VKB Gladiator NXT joystick which I set up so when I turn the encoder it acts like an axis; turning it up or down translates the axis up and down. I also set up the hat switch to translate this axis with a faster rate, so I can set the trim fast and precisely at the same time.
I use this method as it seems to be more responsive and accurate than using the assigned trim up and down buttons.

My problem with this is the axis can be desynchronized with the in-game trim setting after using the autopilot, which is why I want to use a virtual axis to set the trim, so I can synchronize periodically (this interferes with the sim due to latency) or when disengaging the autopilot.
My other problem is that I recently bought a Honeycomb Bravo which also has a (encoder) trim wheel I want to use to translate the same axis.

So I had an idea of

  • setting up a vJoy device with one axis,
  • setting that axis to be the Elevator Trim Axis (in the sim),
  • using AAO to move this vJoy axis to the sim's trim settings (eg. vJoyAxis = ElevatorTrimPosition),
  • and to translate this axis when using my encoders and HAT switch (eg. vJoyAxis = vJoyAxis + 1000).

Sorry, but I don't get it. Why not just do all of this in scripts, why the detour through vJoy and an internal assignment in the sim?

Edited by Lorby_SI

LORBY-SI

  • Commercial Member

Off the top of my head I would create a script to handle the trim axis:
Group: CustomTrim
Script: TrimAxis
Code: (L:CustomTrim-TrimAxis) (>K:ELEVATOR_TRIM_SET)
(or maybe K:AXIS_ELEV_TRIM_SET, you would have to try that)

This I assign to the physical axis in AAO, setting AxisMin -16K and AxisMax +16K

When applying this script, the scriptvariable (the LVar bearing the script's name) becomes available. So you create another script with the exact same code and run that as an Aircraft Automated Script, maybe every 250ms or something.

Group: CustomTrim
Script: TrimUpdate
Code: (L:CustomTrim-TrimAxis) (>K:ELEVATOR_TRIM_SET)

This should theoretically do the same thing, whithout any hassle, vJoy or extra assignments. With the script assigned to your encoder the LVar is set and the trim is set at the same time. The update script then enforces this setting periodically.

Edited by Lorby_SI

LORBY-SI

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.