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.

Any script for AP control via buttons and one rotary encoder

Featured Replies

  • Commercial Member

Hi!

I have VKB Gladiator NXT EVO, and I thought why shouldn't I use it's full capabilities, and assign three buttons on the base to select SPD, HDG and ALT, and then use rotary encoder as a knob to adjust selected function, and throttle wheel to adjust the VS for example. Very similar to what Knobster does with one button and two rotary encoders.

I never found a way to do the above thing via XP11/12 controls menu, so I hope it can be done via simple lua script or plugin, and which one?

 

Thank you in advance.

 

spacer.png

Current system: ASUS PRIME Z690-P D4, Intel 12900k, 32GB RAM @ 3600mhz, Zotac RTX 3090 Trinity, M2 SSD, Oculus Quest 2.

FlyWithLua. Finding out the values of your input axis and buttons is the crucial part, the rest is a lot of "if"s and "then"s. Writing Lua scripts should be manageable if you can at least read C and Python.

7950X3D + 7900 XT + 64 GB + Linux | 4800H + RTX2060 + 32 GB + Linux
My add-ons from my FS9/FSX days

  • Author
  • Commercial Member
On 12/28/2023 at 4:20 PM, mSparks said:

the sparky744 includes MCP hotspots written in lua that change a command up/down function based on what you are looking at.

https://github.com/mSparks43/747-400/blob/0173f76ce4eba7f14175972610cc08dc6955e5e3/plugins/xtlua/init/scripts/B747.99.VRcontrols/B747.99.VRcontrols.lua#L269

should be fairly easy to repurpose that to your needs. 

Thanks. But sadly I don't understand LUA coding much. I was using ChatGPT to create couple of simple LUA files for my type of dynamic LOD script, but of course, FlyWithLua thew it into the quarantine folder, and I spent like 5 hours to debug lol. I was on edge to abort to whole idea but luckily found what was the issue with the script.

I was searching for a practical solution, some kind of plugin or script that will add custom datarefs, to which I can assign buttons to control particular AP values like SPD, HDG or ALT, with a rotary encoder.

On 12/28/2023 at 7:21 PM, Bjoern said:

FlyWithLua. Finding out the values of your input axis and buttons is the crucial part, the rest is a lot of "if"s and "then"s. Writing Lua scripts should be manageable if you can at least read C and Python.

I can't read C and Python, never touched both. As I said above, I was using ChatGPT to write couple of really simple LUA scripts, and literally spent hours to debug the errors in both, only because I don't know the basics, how to properly call the datarefs etc.

Edited by Pe11e

Current system: ASUS PRIME Z690-P D4, Intel 12900k, 32GB RAM @ 3600mhz, Zotac RTX 3090 Trinity, M2 SSD, Oculus Quest 2.

10 minutes ago, Pe11e said:

Thanks. But sadly I don't understand LUA coding much. I was using ChatGPT to create couple of simple LUA files for my type of dynamic LOD script, but of course, FlyWithLua thew it into the quarantine folder, and I spent like 5 hours to debug lol. I was on edge to abort to whole idea but luckily found what was the issue with the script.

for a really simple version, lua supports assigning functions to a variable.

e.g.

function iasup()

 -- increase IAS

end

local upFunc = iasup

upFunc:once()

that script I linked does it by finding the function assigned to the closest x,y,z point in the direction being looked at.

if you are using buttons you can just do it directly from thier function.

if you struggle Im back at my desk on like the 5th of Jan or smth, it'll only take 5 minutes or so to make you a lua script you can drop in any aircraft that uses xlua.

if you want a look version all you need is the x,y,z of the knobs you want to turn and drop it in the hotspot array. (I have 2 rotaries, hence two functions)

Edited by mSparks

AutoATC Developer

  • Author
  • Commercial Member
2 hours ago, mSparks said:

for a really simple version, lua supports assigning functions to a variable.

e.g.

function iasup()

 -- increase IAS

end

local upFunc = iasup

upFunc:once()

that script I linked does it by finding the function assigned to the closest x,y,z point in the direction being looked at.

if you are using buttons you can just do it directly from thier function.

if you struggle Im back at my desk on like the 5th of Jan or smth, it'll only take 5 minutes or so to make you a lua script you can drop in any aircraft that uses xlua.

if you want a look version all you need is the x,y,z of the knobs you want to turn and drop it in the hotspot array. (I have 2 rotaries, hence two functions)

So you are practically saying that I can control any knob via rotary encoder, if I look directly at it in VR? It's kinda hard to know where exactly you look without any dot/crosshair. 

I apologize if I didn't understand you well. (We are both speaking Serbian if I'm not mistaken). 🙂

Current system: ASUS PRIME Z690-P D4, Intel 12900k, 32GB RAM @ 3600mhz, Zotac RTX 3090 Trinity, M2 SSD, Oculus Quest 2.

1 hour ago, Pe11e said:

So you are practically saying that I can control any knob via rotary encoder, if I look directly at it in VR? It's kinda hard to know where exactly you look without any dot/crosshair. 

I apologize if I didn't understand you well. (We are both speaking Serbian if I'm not mistaken). 🙂

it works fine in 2d as well, I just wrote it for VR,

that hit works on closest match, e.g. in that  744 script looking to the left of the mcp, my two rotaries do ias and heading, if looking to the right of the mcp they do Alt and VS, if looking down it does com1. I use those $2 ardunino rotaries, so they have push button functions as well.

It took a bit of tweeking to get comfortable in the R44, but I use similar there for qnh, radio heading com and nav radios (which is what I wrote it for originally), the math was fun, size of spheres tangential to a line, closest match is the smallest sphere. which simplifies down to almost nothing, couple of cos sins and a square root.

Edited by mSparks

AutoATC Developer

21 hours ago, Pe11e said:

I can't read C and Python, never touched both. As I said above, I was using ChatGPT to write couple of really simple LUA scripts, and literally spent hours to debug the errors in both, only because I don't know the basics, how to properly call the datarefs etc.

Well, you know what to do then: Learn the basics. FlyWithLua has a good manual and a large collection of example scripts.

7950X3D + 7900 XT + 64 GB + Linux | 4800H + RTX2060 + 32 GB + Linux
My add-ons from my FS9/FSX days

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.