Jump to content
The simFlight Network Forums

Setting vJoy buttons from a LUA script


Recommended Posts

Posted (edited)

I seemingly cannot get FSUIPC7 to “press” a button on a vJoy device.  I created vJoy device ID 1 using the Configure vJoy tool, and am monitoring it using vJoy monitor.  I can use the vJoy feeder demo app and see the button states toogle in the viewer as expected.  Then I wrote a LUA script which is running as I can see in the log file.  It loops endlessly while writing a ‘1’ to offset 0x3340 as below

while true do

    ipc.writeUD(0x3340, 1)

    sleep(1000)

end

However, there is no change in status in vJoy monitor.  I would expect to see button 1 set on vJoy ID #1, similarly to using the feeder app.  I can confirm that the value 0x01 is being written into the correct offset 0x3340 by putting a watch on that location.  FSUIPC is just not delivering that news to vJoy, or so it appears.

There are no errors in the log.  In debug mode I can see the execution repeating the lines over and over in the while loop continuously.  The script has not terminated either with or without errors.

What could I be doing wrong?  I feel like I must be missing a basic concept here as this appears to be a rather simple task.

P.S.,

My reason for wanting to do this is that the Airbus A320 sidestick has but one trigger on it for radio comms PTT.  For SayIntentionsAI ATC app, it would be nice to have a second intercom PTT button somewhere to talk to the AI copilot and/or cabin crew.  For this I need vJoy to interface with SayIntentionsAI.

Configuration:

FSUIPC 7.5.1, Windows 11 24H2, MSFS 2020, Brunner CLS-E Joystick (A320 version), full A320 hardware cockpit from Skalarki, SayIntentionsAI, ActiveSky for MSFS.

Edited by Holt
missing info
Posted

I think you are misunderstanding the functionality provided by offset 0x3340. Setting a button flag in that offset range will trigger a virtual button press in fsuipc, which will trigger the button assignment in FSUIPC and you can see the button in FSUIPC's button assignment panel for assignment. it cannot simulate a button press for other applications, i.e. it is not possible to force/send an actual button press event for other programs to action.

John

Posted
13 hours ago, Holt said:

My reason for wanting to do this is that the Airbus A320 sidestick has but one trigger on it for radio comms PTT.  For SayIntentionsAI ATC app, it would be nice to have a second intercom PTT button somewhere to talk to the AI copilot and/or cabin crew.  For this I need vJoy to interface with SayIntentionsAI.

But how are you expecting to trigger this virtual button press? Rather than the trigger writing to offset 0x3340 to trigger a virtual button, that then triggers the PTT, why can't the initial trigger just trigger the PTT directly?

Posted
5 hours ago, John Dowson said:

I think you are misunderstanding the functionality provided by offset 0x3340. Setting a button flag in that offset range will trigger a virtual button press in fsuipc, which will trigger the button assignment in FSUIPC and you can see the button in FSUIPC's button assignment panel for assignment. it cannot simulate a button press for other applications, i.e. it is not possible to force/send an actual button press event for other programs to action.

John

Oh…that would explain everything then.

Posted
59 minutes ago, John Dowson said:

But how are you expecting to trigger this virtual button press? Rather than the trigger writing to offset 0x3340 to trigger a virtual button, that then triggers the PTT, why can't the initial trigger just trigger the PTT directly?

I was planning to use the intercom switch on the Airbus Radio Control Panel by Skalarki.  Their hardware talks to a proprietary software on the PC which interfaces directly through an SDK into the Pro-Sim software.   Pro-Sim allows me to use a software “gate” (intercom switch set) to write into an FSUIPC offset.  That part is all working fine.  The problem now is how to get from a FSUIPC offset to something that SayIntentionsAI can see.  I saw the advantage of a joystick button press being that it wouldn’t require window focus to work, unlike a keyboard press.  I guess I need a different plan.

Posted
1 hour ago, Holt said:

The problem now is how to get from a FSUIPC offset to something that SayIntentionsAI can see.

But why does  SayIntentionsAI need to see this? If the button on the intercom switch of the Airbus Radio Control Panel triggers this and writes to an FSUIPC offset (via the "gate"), then you can have a lua script that monitors the offset and sends the required PTT control to the FS.

How is the current PTT button assigned - is that in FSUIPC or elsewhere?

Posted
3 minutes ago, John Dowson said:

But why does  SayIntentionsAI need to see this? If the button on the intercom switch of the Airbus Radio Control Panel triggers this and writes to an FSUIPC offset (via the "gate"), then you can have a lua script that monitors the offset and sends the required PTT control to the FS.

How is the current PTT button assigned - is that in FSUIPC or elsewhere?

The PTT event needs to go to SayIntentionsAI ATC, which is a standalone program, not to the FS.  The AI software gets the audio stream from the microphone, but needs help knowing when I’m  talking on the intercom so it doesn’t have to feed a continuous audio stream to ChatGPT for speech recognition, which would be prohibitively expensive.  For ATC radio transmissions it is triggered by the PTT switch on the Brunner joystick, which then results in a vJoy button press via the Brunner hardware interface software.  That vJoy button is finally read in SayIntentionsAI.  I was hoping to mimic the same flow using FSUIPC and a Lua script.  Pro-Sim will not create the vJoy event for me as does the Brunner software.  It will only write to a FSUIPC offset for custom user actions.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.